Re: osacompile
Re: osacompile
- Subject: Re: osacompile
- From: Luther Fuller <email@hidden>
- Date: Tue, 8 Nov 2005 15:20:05 -0600
has replied ...
>how does the editor know [if a script is editable]?
By calling the OSA's OSAGetScriptInfo() function with the
kOSACanGetSource selector. See:
http://developer.apple.com/documentation/Carbon/Reference/Open_Scripti_Architecture/Open_Script_Arch/chapter_1.2_section_4.html
You could write an osax to do this; it'd be about a half dozen lines
of C code.
Interesting. But, is there any way to install the osax in my
application bundle instead of a ScriptingAdditions folder? (and its
been years since I've written C code)
and again replied ...
>The reason I needed to read the 'run-only' flag of a file,
if such a thing exists, was so that I could avoid compiling
an already compiled script with osacompile.
Why? It's perfectly legal to pass a compiled script to osacompile.
Anyway, the 'run-only' flag won't tell you if a file is a compiled
script or not, only if a compiled script can be decompiled or not.
I'd suggest just passing whatever gets dropped straight to
osacompile and let it worry about what's acceptable or not, and
handling any errors it raises as required.
Yes, it's legal and I would know exactly what had happened if I were
to accidentally compile a run-only AppleScript application. But I
don't want to pass this along to users. Actually, the chances of this
happening to a user is small, but I would have to write an additional
paragraph in the documentation just to explain it, which is a sure
invitation for someone to try it.
I need to decide whether the handler I'm rewriting should:
1. continue to use Script Editor to compile scripts; or
2. switch to osacompile.
Both seem to work equally well, except Script Editor has a visual
distraction when the script editing window opens, then immediately
closes, while osacompile has the little problem we've been
discussing. I'm leaning toward staying with Script Editor.
_______________________________________________
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