OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Calc - popup message which stays on-screen for n seconds

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
NightOwl
Newbie
Newbie


Joined: 14 Jun 2009
Posts: 2
Location: Scotland, UK

PostPosted: Sun Jun 14, 2009 11:49 am    Post subject: Calc - popup message which stays on-screen for n seconds Reply with quote

Hi,

first post on here - thought I would share how I got this to work although there may be better ways. I wanted to display a message from a calc macro that stayed on the screen for a set number of seconds, then went away without the user having to click the OK button.

I looked for ages here and all over the internet and found nothing which helped.

Eventually I found a solution which is easy-ish. Call a shell script. I use xubuntu so can use zenity to popup a message, with the timeout value telling zenity how long the text should stay on screen. Other unix systems could use alternatives such as xdialog.

Sample macro code:
Code:
Sub ShellMessage1()
   ' call shell command. 4th argument is set to True so that we wait for the command
   ' to complete before we do anything else.
   shell("/home/mwatson/msg.sh", 2, ,True)
End Sub


The shell script (in this case msg.sh) was created with this code:
Code:
#!/bin/sh
zenity --timeout 5 --info --text "Click CurrentAccount button to update this spreadsheet. Also, remember to select an area prior to printing..."


Also, remember to make the shell script executable! ie chmod +x msg.sh

Hope this helps someone else who is trying to solve this particular problem.
_________________
OpenOffice 2.1.4 on xubuntu 8.04
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Sun Jun 14, 2009 10:45 pm    Post subject: Reply with quote

Wow! A script that does not even require OpenOffice.org to be installed, just a whole Linux stack including a program called "zenity".
_________________
Rest in peace, oooforum.org
Get help on https://forum.openoffice.org
Back to top
View user's profile Send private message
NightOwl
Newbie
Newbie


Joined: 14 Jun 2009
Posts: 2
Location: Scotland, UK

PostPosted: Mon Jun 15, 2009 6:26 am    Post subject: Reply with quote

Villeroy wrote:
Wow! A script that does not even require OpenOffice.org to be installed, just a whole Linux stack including a program called "zenity".


I was hoping that someone would say that you could do this in OpenOffice without calling an external script. Is there a way to do that?
_________________
OpenOffice 2.1.4 on xubuntu 8.04
Back to top
View user's profile Send private message
Fұva
Newbie
Newbie


Joined: 16 Jul 2009
Posts: 3

PostPosted: Mon Jun 07, 2010 11:11 am    Post subject: Reply with quote

Here is without the external script.
Code:

Sub Main
Shell ("bash -c 'zenity --timeout 5 --info --text ""Click CurrentAccount button to update this spreadsheet. Also, remember to select an area prior to printing...""'",2,,true)
End Sub
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group