27 November 2007

AppleScript: Enhanced Application Object Model

I still don’t know why my on idle script that updated the “currently playing” item on my blog doesn’t work in Leopard, but this new bit is quite useful for just about anything you want to do with AppleScript:

tell application "iTunes"

  −− won’t launch iTunes if it isn’t running

  if it is running then

    pause

  end if

end tell

 

And the variant I find more intuitive:

if application "iTunes" is running then

  tell application "iTunes"

    pause

  end tell

end if

 

P.S. Hmm, for some reason the “Stay Open” bit you must set when saving the on idle application had gotten lost at some point.