profx
ill never 4get watsisname
well, slightly more complicated than that:
I have written two applescripts, one that is executed just before system sleep the other when the system wakes.
The first checks if itunes is running and if it is playing.
The second then resumes playing if itunes was playing before sleep.(notice the classy fade in)
on sleep: itunesSleep.scpt
on wake: itunesWake.scpt
these work perfectly when run from script editor but when run from terminal as
osascript -l Applescript itunesSleep.scpt
it packs a sad and fails to write the itunesStatus.txt file because the player status is
<<constant ****kPSP>> when run from terminal no matter what state the player is actually in.
Anyone have any ideas as to what is going on??
By the way i am planning on using sleepwatcher to run the scripts, but it can only run unix scripts, hence the need to use osascript.
Cheers.
I have written two applescripts, one that is executed just before system sleep the other when the system wakes.
The first checks if itunes is running and if it is playing.
The second then resumes playing if itunes was playing before sleep.(notice the classy fade in)
on sleep: itunesSleep.scpt
Code:
try
do shell script "top -l 1 | grep 'iTunes'"
tell application "iTunes"
if player state as string is "playing" then do shell script "/bin/echo play >~/itunesStatus.txt"
end tell
end try
on wake: itunesWake.scpt
Code:
try
tell application "iTunes"
do shell script "/bin/cat ~/itunesStatus.txt"
set stat to result as string
set vol to sound volume as number
set sound volume to 0
if stat is "play" then play
repeat with i from 1 to vol
set sound volume to i
set i to i + 1
delay 0.4
end repeat
do shell script "/bin/rm ~/itunesStatus.txt"
end tell
end try
these work perfectly when run from script editor but when run from terminal as
osascript -l Applescript itunesSleep.scpt
it packs a sad and fails to write the itunesStatus.txt file because the player status is
<<constant ****kPSP>> when run from terminal no matter what state the player is actually in.
Anyone have any ideas as to what is going on??
By the way i am planning on using sleepwatcher to run the scripts, but it can only run unix scripts, hence the need to use osascript.
Cheers.