Re: Check if iTunes is playing?
Re: Check if iTunes is playing?
- Subject: Re: Check if iTunes is playing?
- From: kai <email@hidden>
- Date: Mon, 4 Apr 2005 01:52:35 +0100
On Mon, 4 Apr 2005 09:09:42 +1000, "Shane Stanley" wrote:
On Sun, 3 Apr 2005 12:00:03 -0400, Neil Lee wrote:
Is this the "best' way to check if iTunes is playing? I want to do a
check if iTunes is playing, and if it isn't I want the script to exit.
if not (player state as string is "playing") then return
No. Don't coerce keywords to strings. When you run that in a script
editor, with the dictionary of iTunes available to it, playing will
coerce to "playing". When you run it elsewhere, the script won't bother
opening the dictionary, so you'll get "KPSP". If you want the
comparison
to work, use "if not (player state is playing) then return".
Good point, Shane.
I seem to recall, way back when, a situation in which somebody actually
wanted to achieve the class-to-string coercion to show the current
state of a property in an applet's dialog box. One of the solutions was
to use a meaningless 'run script' command, aimed at the target app, to
force open its dictionary for the duration of that session. It its
simplest form, it went something like:
run script "tell application \"SomeApp\" to \"\""
tell application "SomeApp"
display dialog <some keyword> as string
end tell
However, I digress... :-)
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden