Re: Suggestion: iTunes needs a refresh event
Re: Suggestion: iTunes needs a refresh event
- Subject: Re: Suggestion: iTunes needs a refresh event
- From: Richard 23 <email@hidden>
- Date: Sun, 14 Mar 2004 15:18:18 -0800
>
> I'd like to see iTunes send a "Playing a new song" event.
>
> All the iTunes scripts out there send an interval query
>
> which is processor intensive and always delays the
>
> detection of a new song.
>
>
>
> Any support on this one?
>
I've been thinking for a long time that this would be an excellent
>
feature. Until now, my scripts and apps have been using an idle handler
>
to check every few seconds for the current song and comparing it to a
>
global. How do you think this would work?
...
>
Has anyone already filed an enhancement request for this?
I, on the other hand, haven't given this much thought, nor
have I taken a crack at scripting iTunes. Although this
has never prevented me from saying something anyway.
An application initiating an event that it does not
handle in the hope that some unknown target will
somehow and intercept and handle said event sounds
like a hack to me.
Although a four letter word, I certainly have no
bias against hacks per se. Applications everywhere
would grind to halt if not for the ingenuity of hacks.
However it sounds like a callback is what is needed.
Perhaps the enhancement request should be for making
iTunes attachable. I think that's the correct term.
iTunes already has appropriate event handlers in
place, such as "play" and "next track", a script
needs to be able to modify these handlers by
attaching its own, with custom behavior and a
continue statement.
I think it would look something like this:
tell application "iTunes"
script
on next track
-- log that we're starting the next track,
-- override by not continuing the event, or whatever
continue next track
-- log that we're done with the next track or whatever
end next track
end script
set its script to result
end tell
"Style" uses the script property to attach events at dynamically.
Other applications do this at startup by means of an "Attachments"
script in the same folder as the application.
Apologies if I don't have this quite right. I must confess I
haven't run across that many "attachable" applications and
therefore haven't actually written such scripts.
I've only modified global event handlers, such as "path to".
R23
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.