I have this code as a standalone script that works perfectly when run:
tell application "iTunes"
playpause
set status to (get player state) as text
end tell
display dialog status
I then put that into and if block in another script here:
else if (currentitem is "pause") or (currentitem is "play") then
if appIsRunning("iTunes") then
tell application "iTunes"
playpause
set status to (get player state) as text
end tell
display dialog status -- check to see if status is correct, it's not!!!!!
set reply's end to {status & ", "}
else
set reply's end to {"Unable to pause/play, "}
end if
And I don’t know what the problem is, but for some reason instead of setting the status to “playing” or “paused” it is giving me “«constant ****kPSP»” and “«constant ****kPSp»” in the dialog box! The dialog box is only there for debugging purposes, to find out where the result is going bad.
Why is my script not returning the proper value for the player state here, when if I take the code out of the if block, it works just fine?