Re: applescript-users digest, Vol 2 #141 - 12 msgs
Re: applescript-users digest, Vol 2 #141 - 12 msgs
- Subject: Re: applescript-users digest, Vol 2 #141 - 12 msgs
- From: Ken Victor <email@hidden>
- Date: Sun, 17 Dec 2000 13:15:52 -0800
thanx. that did it.
ken
At 12:11 PM -0800 12/17/00, Jason W. Bruce wrote:
Date: Sun, 17 Dec 2000 14:10:24 -0600
Subject: Re: applescript-users digest, Vol 2 #140 - 12 msgs
From: "Jason W. Bruce" <email@hidden>
To: email@hidden
Ken,
The reason the DoIt() handler can't call Logmessage is a question of scope.
You have loaded DeleteScriptName into a variable declared inside the
DoDelete handler. Once the DoDelete handler finishes executing, the
variable you've used to load the plug-in goes out of existence and is no
longer visible to other handlers -- it's local to the DoDelete handler. If
you load the plug-in into a property at the top level of the main script,
or, as Ted said, into a script object, you will be able to call it from
anywhere in the script by targeting the property or script object.
At top level:
Property DeleteScript : load script "Your Plug In"
Then, anywhere you need to call the plug in, you call it by targeting
DeleteScript
on DoIt()
tell DeleteScript to LogMessage(whatever)
end DoIt
Jason Bruce
i would like to have a compiled script that uses various "plug in"
scripts in separate compiled script files. in the main script i would
like to have a number of utility routines that could be used by each
of the plugins. i can successfully load and execute the plugins;
however, i haven't been able to figure out the proper syntax in order
to be able to use routines in the main script from the plugins.
my main script is something like:
on run()
...
DoDelete()
...
end run
on DoDelete()
set DeleteScript to (load script file DeleteScriptName)
tell DeleteScript to DoIt()
end DoDelete
on LogMessage( theMessage)
...
end LogMessage
and then the delete plug in might be:
on DoIt()
...
LogMessage("from Delete PlugIn")
...
end DoIt
its the call to LogMessage in the plugin that doesn't seem to work.
i've also tried using:
tell parent to LogMessage("from Delete PlugIn")
and this doesn't work either
is this kind of structure possible? (it seems like it should somehow
be possible.) and if so, how do i get it to work?
thanx,
>>ken