Help Expected end of line, etc. but found end of script.
here is the sctipt ive tried to write, its not finished so some of the things my seem a bit weird at the moment but here it is as it stands
global okflag
set okflag to false
set front_app to (path tofrontmost applicationasUnicode text)
-- check if iTunes is running
tell application "System Events"
if process "iTunes" exists then
set okflag to true--iTunes is running
end if
end tell
if okflag is true then
set Timer to ""
display dialog "Sleep Time (Minutes)" default answerTimerbuttons {"Cancel", "OK"} default button 2
set Timer to text returned of the result
delay Timer * 60
tell application "iTunes"
set currentVolume to the sound volume
if (player state is playing) then
repeat
--Fade down
repeat with i from currentVolume to 0 by -1
set the sound volume to i
delay 1
end repeat
pause
--Restore original volume
set the sound volume to currentVolume
exit repeat
end repeat
if okflag is false then
display dialog "iTunes not playing" buttons {"OK"} default button 1 with icon stop
end if
end
it doesnt seem to work after the tell "iTunes part i copied and pasted from another applescript
(the purple text)
MacBook Air, Mac OS X (10.7.1)