Well, the way the script is written now there does have to be a global boolean variable, in this case okflag. It could just as easily be written as something like
tell application "System Events" if process "iTunes"existsthen try tell application "iTunes" set currentvolume tothe sound volume if comment of current track is"Proximity Paused"then set comment of current track to""
play repeatwith j from0to currentvolume by 2--try by 4 on slower Macs setthe sound volume to j endrepeat endif endtell tell application front_app
activate endtell onerror
beep endtry endif endtell
This exact code doesn't work for me though. So i put okflag there as a global variable so that it can be accessed throughout the script and not redefined in different places.
Keith:
Well, the way the script is written now there does have to be a global boolean variable, in this case okflag. It could just as easily be written as something like
if process "iTunes" exists then
try
tell application "iTunes"
set currentvolume to the sound volume
if comment of current track is "Proximity Paused" then
set comment of current track to ""
play
repeat with j from 0 to currentvolume by 2 --try by 4 on slower Macs
set the sound volume to j
end repeat
end if
end tell
tell application front_app
activate
end tell
on error
beep
end try
end if
end tell
This exact code doesn't work for me though. So i put okflag there as a global variable so that it can be accessed throughout the script and not redefined in different places.
http://macscripter.net/viewtopic.php?id=24475