RE: iTunes, NSAppleScript, and timeout
RE: iTunes, NSAppleScript, and timeout
- Subject: RE: iTunes, NSAppleScript, and timeout
- From: Olof Hellman <email@hidden>
- Date: Thu, 22 Mar 2007 14:31:17 -0700
- Acceptlanguage: en-US
- Thread-topic: iTunes, NSAppleScript, and timeout
There's a carbony technical Q&A document which has source code : QA 1111
http://developer.apple.com/qa/qa2001/qa1111.html
The idea is that
1) a compiled script is included with the application. This script has (at least) a handler with a name like 'patricks_handler' which takes a list of arguments
2) At runtime, that script is loaded with OSALoad, which results in an OSAID context.
3) You create an AppleEvent of class: 'ascr' id: kASSubroutineEvent -- you supply the subroutine name and your list of parameters there.
4) Instead of sending the event with AESend, you call OSAExecuteEvent with the event and the context.
The advantage over compiling your script on the fly is that the script only needs to be compiled once, at compile time if you'd like, and there's no need for the GetAETE event.
And although it's too late now, this is probably a better discussion for the applescript-implementors list....
- Olof
Microsoft MacBU
-----Original Message-----
From: patrick machielse [mailto:email@hidden]
Sent: Thursday, March 22, 2007 1:59 PM
To: Olof Hellman
Cc: email@hidden
Subject: Re: iTunes, NSAppleScript, and timeout
Op 22-mrt-2007, om 21:25 heeft Olof Hellman het volgende geschreven:
> Patrick wrote --
>
>> I will be modifying the source in my application,
>> so this isn't an option for me.
>
> Rather than modifying the AppleScript source in your application,
> could you solve your problem by loading a compiled script and
> calling into it with a parameter list that you define in your
> application? If so, then you should investigate the AppleScript
> subroutine event.
Hmm, could you elaborate on that last sentence? It sounds very
interesting, but I don't fully understand it ;-)
As far as I know, I could implement this strategy by setting up an
NSTask to execute 'osascript get.scpt arg1'. That should work (also
because I don't really need to get any data back from the script) but
it would be a bit more work to set up, and a bit slower to execute.
patrick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden