Re: Save a NSAppleScript to a file
Re: Save a NSAppleScript to a file
- Subject: Re: Save a NSAppleScript to a file
- From: matt neuburg <email@hidden>
- Date: Sun, 23 Nov 2003 21:01:09 -0800
On Sun, 23 Nov 2003 22:46:02 +0100, Lorenzo <email@hidden>
said:
>
I am letting the
>
users write their own short AppleScript in my
>
applications, just to be executed at launch and before
>
quit. So they could write whatever in the AS string code.
>
It's not something like a fixed string code. It could vary
>
all the time. It could be "tell application" or "mount
>
volume" or a very complex script.
>
>
So I think the best is to compile the AS when the user,
>
after he wrote the AS text, presses the button Apply, then
>
if there are no errors I save the compiled script somehow,
>
then when the user later launchs the app, my app executes
>
the compiled AppleScript. The problem is that I cannot
>
save the compiled AppleScript.
You can script the Script Editor to save the file for you. Or,
even simpler, just let the user write the script in Script Editor
and save it where your program can get at it; that is the usual
thing (for example, look at BBEdit - it does lots of things with
scripts the user writes, but the user cannot compile and save any
of them using BBEdit).
If you *really* insist upon compiling and saving an AppleScript
program, yourself, then you must use OSACompile (to obtain the
scriptID) and OSAStore. You can then store the data in any manner
you like, and can later run it with OSALoad and OSAExecute. m.
--------
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
AppleScript: the Definitive Guide! Coming real real soon...!
http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.