Re: Results differ in editor and applet
Re: Results differ in editor and applet
- Subject: Re: Results differ in editor and applet
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 26 Feb 2004 10:26:25 -0800
On 2/26/04 9:17 AM, "Mr Tea" <email@hidden> wrote:
>
When I run this in a script editor...
>
>
tell application "iTunes"
>
set c to class of current track as string
>
my dlog(c)
>
end tell
>
>
on dlog(c)
>
display dialog c
>
end dlog
>
>
... the dialog displayed is "audio CD track"
>
>
But, when the same script is run as an applet, it displays "<<class cCDT>>"
>
>
Why the difference? Why!?
The "Englishy" keywords aren't preserved outside their own context
(application tell block). The same thing happens when you export application
constants (e.g. 'highest as string' in Entourage, referring to priority of a
task or message) to a text file. I think that script editors preserve the
context somehow while you're in them - I'm not clear on this.
To make the app's dictionary accessible to the script, include this near the
top of the script, before you call the application:
run script "tell application \"iTunes\"
end tell"
Naturally you don't want to be doing this hundreds of times per script (its
slow), so don't put it in a repeat loop. Just once, near the top of the
script.
--
Paul Berkowitz
_______________________________________________
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.