Hey all, for my play pause button im using a cheesy way of making it a “custom” button. What I did was drew the image in fireworks, one with the play icon and one with the pause, and then dragged it on to my project and created a transparent button overtop that the user can’t see. Normally with regular buttons you could set the icon/alternate icon to the playerstate using something along these lines:
tell application "iTunes"
set isPlaying to player state is playing
end tell
set state of button "pp_button" of of window "window" to isPlaying
no the problem is I don’t have a button. I have an image with a button on top. So think of it as setting the image of an image view to the pause image when iTunes is paused and the play image when it’s playing.
tell application "iTunes"
set thestate to (player state) as string
end tell
if thestate = "paused" then
return 1
else
return 2
end if
but this does not
tell application "iTunes"
set thestate to (player state) as string
end tell
if thestate = "paused" then
tell window "window"
set image of image view "playview" to image5
end tell
else
tell window "window"
set image of image view "playview" to image4
end tell
end if
my only guess is that im loading the two images needed in the wrong spot (I load them in an on will finish launching handler) and my other wild guess it that because first i declare the image as properties like so:
property image4: null
property image5 : null
Plus I’m running the code in awake from nib, idle, and launched if that helps;)
That is where got the idea from
The “custom” button displays fine
it just doesn’t respond correctly to iTunes’s playerstate except right when you launch it it sets the button state right but it doesn’t change during regular run time