The first script runs to completion whether in foreground or in background :
tell me to activate
display dialog "this is a test dialog at
" & (current date) giving up after 5
WHY does this second script run to completion ONLY if in the foreground, while if in the background it pauses and bounces the dock icon:
tell me to activate
set ivWas to input volume of (get volume settings)
set ovWas to output volume of (get volume settings)
set avWas to alert volume of (get volume settings)
set volume alert volume 75
set volume output volume 100 -- set volume with output unmuted
set iv to input volume of (get volume settings)
set ov to output volume of (get volume settings)
set av to alert volume of (get volume settings)
do shell script "pmset -a womp 1" user name "user01" password "password01" with administrator privileges
say "Good Morning!"
display dialog "We will now cease QUIET mode." & "
input, output, & alert volumes were " & ivWas & ", " & ovWas & ", " & avWas & "
input, output, & alert volumes are " & iv & ", " & ov & ", " & av & "
Wake On Magic Packet (WOL) is set ON" giving up after 3
whereas, a very similar script (only significant difference is no “say”) behaves like the first
tell me to activate
set ivWas to input volume of (get volume settings)
set ovWas to output volume of (get volume settings)
set avWas to alert volume of (get volume settings)
set volume alert volume 0
set volume output volume 0 -- set volume with output muted
set iv to input volume of (get volume settings)
set ov to output volume of (get volume settings)
set av to alert volume of (get volume settings)
do shell script "pmset -a womp 0" user name "user01" password "password01" with administrator privileges
display dialog "We will now set QUIET mode." & "
input, output, & alert volumes were " & ivWas & ", " & ovWas & ", " & avWas & "
input, output, & alert volumes are " & iv & ", " & ov & ", " & av & "
Wake On Magic Packet (WOL) is set OFF" giving up after 5
FYI the two scripts are run by a timer, to make the 2008 iMac shut up and keep its’ screen dark at night.
Model: iMac (early 2008)
AppleScript: 2.1.2
Browser: Firefox 3.6.24
Operating System: Mac OS X (10.6)