PDA

View Full Version : Applescript: how to tell if iTunes is paused




sammich
May 25, 2009, 06:55 PM
I can get iTunes to give me the player state, it will give me a string like <constant ****kPS#>, where # is "p" for paused, "P" for playing, and "S" for stopped.

This should be cake:

set thechar to character 18 of (player state)
if thechar is equal to "p" then set ispaused to true

Now I discover AS is more or less case-blind/insensitive. Is there a way I can do this?



mrzeve
May 25, 2009, 10:40 PM
I'm not entirely sure what it is you are asking..but here is how I used Applescript to check if iTunes was paused. It works without any issues..


tell application "iTunes"
try
set whatshappening to (get player state as string)
end try

if whatshappening = "paused" then
return "its paused"
end if

end tell