On May 4, 11:49 am, J <[email protected]> wrote:
> the AppleScript dictionary
> doesn't support click feedback.
In case anyone's interested or it helps at all, I've found a bit of a
work around: I just use the "do shell script" command in my
applescript to call growlnotify, which you'd normally use from the
command line or in shell scripts. growlnotify takes a --wait flag that
will only return when the growl notification is clicked or times out.
Combined with the --sticky flag, it's enough for what I needed, so I'm
happy.
I've included my script below for reference (sorry if the linebreaks
go a bit weird - I'm not sure how best to include code when posting to
the discussion board).
J
------
-- NB "do shell script" command:
-- Have to give full path to growlnotify.
-- Had to use \ to escape " characters in order to pass them to the
shell without being interpreted by applescript.
-- In order to pass newline to growlnotify mid-message, I had to close
the ", enclose the \n in $'', and escape the \n with \ so that it's
not interpreted by applescript, then re-open the " for the message!
set delayTime1 to 60 * 20
set delayTime2 to 60 * 5
repeat
activate -- activate will bring a specific application to the front,
then call the dialog, so the dialog should be displayed on top of
other windows/applications.
set question to display dialog "Choose an option to set the eye-
strain alarm:" buttons {"20 minutes", "5 minutes", "Turn off"} default
button 1 with icon stop
set answer to button returned of question
if answer is "20 minutes" then
delay delayTime1
do shell script "/usr/local/bin/growlnotify --title \"20 minute
Reminder\" --name \"20 min Growl Reminder - Clickable\" --message
\"You've been looking at the screen for 20 minutes. How about a break?
\"$'\\n\\n'\"Click to show the dialog box.\" --appIcon \"Time Machine
\" --sticky --wait"
else if answer is "5 minutes" then
delay delayTime2
do shell script "/usr/local/bin/growlnotify --title \"5 minute
Reminder\" --name \"5 min Growl Reminder - Clickable\" --message \"5
minutes is up.\"$'\\n\\n'\"Click to choose an option.\" --appIcon
\"Time Machine\" --sticky --wait"
else if answer is "Turn off" then
exit repeat
end if
end repeat
--
You received this message because you are subscribed to the Google Groups
"Growl Discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/growldiscuss?hl=en.