| View previous topic :: View next topic |
| Author |
Message |
NightOwl Newbie

Joined: 14 Jun 2009 Posts: 2 Location: Scotland, UK
|
Posted: Sun Jun 14, 2009 11:49 am Post subject: Calc - popup message which stays on-screen for n seconds |
|
|
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 |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Sun Jun 14, 2009 10:45 pm Post subject: |
|
|
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 http://forum.openoffice.org |
|
| Back to top |
|
 |
NightOwl Newbie

Joined: 14 Jun 2009 Posts: 2 Location: Scotland, UK
|
Posted: Mon Jun 15, 2009 6:26 am Post subject: |
|
|
| 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 |
|
 |
Fұva Newbie

Joined: 16 Jul 2009 Posts: 3
|
Posted: Mon Jun 07, 2010 11:11 am Post subject: |
|
|
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 |
|
 |
|