Re: NSAppleScript: Compiling a script launches an application
Re: NSAppleScript: Compiling a script launches an application
- Subject: Re: NSAppleScript: Compiling a script launches an application
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 29 Jul 2005 08:00:48 -0700
- Thread-topic: NSAppleScript: Compiling a script launches an application
On 7/29/05 7:41 AM, "Gary (Lists)" <email@hidden> wrote:
>
> 'has' wrote:
>>> Working as advertised. There are numerous applications whose
>>> terminology is obtained dynamically, which in AppleScript's case
>>> means launching the application each time the script is compiled.
>>> To avoid compiling your AppleScript each time your application
>>> loads it, save it as a compiled .scpt file instead of source code.
>
> "Alexander von Below" wrote:
>> Unfortunately, the NSAppleScript object does not seem to have the ability to
>> save compiled scripts, unless I am overlooking something
>
> You are likely on the wrong list.
> AppleScript folk, per se, have no dealings with 'NS' anything.
>
> Depending on what you're working on, check the Studio and/or Xcode lists.
> (Or, check out <http://lists.apple.com/> to select the most appropriate
> list.)
Alexander is on the right list. He came here to find out why the behaviour
he saw was happening suspecting, correctly, that it was due to the nature of
AppleScript itself. People on those other lists wouldn't know that (unless
there was an AppleScript expert who happened to be there). Simon, Helmut and
"has" all gave him the right answer, and "has" offered a suggestion as to
how he can avoid his problem. It's true that the next step is a Cocoa one,
but some of us here might be able to help out.
Alexander - you can save the save the script you provided as a compiled
.scpt made in Script Editor, and include it in the bundle of your
application. You can initialize an NSAppleScript object with the URL file
path of the script - rather than the uncompiled source code - and just run
it. Use initWithContentsOfURL:error and executeAndReturnError: . You can do
so with an already-compiled script and it won't re-compile. Just check the
documentation. (I guess a Cocoa list would know more if you need more.)
--
Paul Berkowitz
_______________________________________________
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