Re: Determining if a scripting addition is installed
Re: Determining if a scripting addition is installed
- Subject: Re: Determining if a scripting addition is installed
- From: Matt Neuburg <email@hidden>
- Date: Tue, 06 Sep 2005 08:03:11 -0700
On Fri, 02 Sep 2005 21:42:49 -0500, Laine Lee <email@hidden>
said:
>On 9/2/05 5:29 PM, "kai" <email@hidden> wrote:
>
>> My understanding is that the run script
>> routine you posted would still need to be compiled to be run, but
>> this would occur at runtime - rather than when the rest of the script
>> is compiled.
>
>I understand that the raw code will appear in the script's text in Script
>Editor if the compiled script is opened on a machine where the scripting
>addition is not installed. For that to happen, the script has to first exist
>in its compiled form on the machine which may or may not have the scripting
>addition installed, having been compiled where the scripting addition is
>installed.
>
>I've attempted to provide a method which will allow determining the
>availability of the scripting addition with code that isn't precompiled,
>that is, code that can make the scripting addition availability
>determination if simply copied and pasted into the script editor from a text
>source, or if quoted as an Applescript string and compiled with the
>osacompile command.
>
>I can't think of the term (you probably know what I mean) that refers to a
>scripting language such as php or python that doesn't rely on being
>precompiled to work. Applescript has that capability of being treated that
>way. However, of course, when it is, that first run must accomplish the
>compiling, and take the extra time to which you also refer. But for the
>added benefit of portability, the option is, from my point of view, valuable
>enough to make it an essential member of the scripter's assortment of tools.
>
>If I could keep track of all the precise terminology to which I refer, I'd
>be writing a book instead of posting to a mailing list, if I knew how to
>write a book.
I have written a book and it explains this issue. It even shows how a script
script can test for the presence of a certain scripting addition and load it
and use it, without quitting and restarting, if the user can locate it.
However, it did not have this clever "run script" device. But it does now!
So you see, you've wound up in a book anyway.
try
run script "get the ticks"
on error -- evidently it isn't installed
set jons to choose file with prompt "Please find Jon's Commands:"
set sa to path to scripting additions from user domain
tell application "Finder" to duplicate jons to sa
try
tell me to «event ascrgdut»
end try
end try
display dialog (run script "get the ticks") -- 1974834
As my book also points out, if you are willing to distribute your script as
an applet bundle (or an AppleScript Studio app), the problem is solved
automatically (on Panther or later). m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
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