Re: is it possible to load a script library with a creation handler
Re: is it possible to load a script library with a creation handler
- Subject: Re: is it possible to load a script library with a creation handler
- From: email@hidden
- Date: Sat, 31 Mar 2001 17:08:55 EST
How about this (requires slight change to your parameterList as written):
on createNewAdapativeStairCase(parameterList)
set staircase to load script file (item 1 of parameterList)
tell staircase to initializeItself(rest of parameterList)
end createNewAdapativeStairCase
I think you will find that staircase needs to be a property, and that
successive runs of createNewAdapativeStairCase will overwrite it. The
analysis/resolution of this is left as an exercise for the reader.
Jeff Baumann
email@hidden
www.linkedresources.com
Better living thru Applescript.
In a message dated 3/31/01 11:09:20 AM, Timothy Bates wrote:
>
hi there,
>
I now understand how neat script libraries are (took me a while).
>
>
I have a nifty library which should be initialised when I create an instance
>
of it.
>
>
I was doing this with a handler that contained the script, but I want to
>
move to loading the scripts from file. Unfortunately, now I cannot see how
>
to force the user to initialise the object when they create it because you
>
can't pass parameters to the load script command. Is there anyway around
>
this?
>
>
To help explain, my old script (gutted for simplicity) was:
>
>
set myStaircase to my createNewAdapativeStairCase({1,2,3})
>
>
returnParameters() of myStaircase
>
--> {1,2,3}
>
>
on createNewAdapativeStairCase(parameterList)
>
script staircase
>
property parameters: parameterList
>
on returnParameters()
>
return parameters
>
end returnParameters
>
end script
>
end createNewAdapativeStairCase
>
>
Does anyone out there have any clues on including a handler like this in a
>
loadable script object so that it is called at load time? Is thought that
>
load like be like "run" so I could simply include the code and gets called
>
automagically, but no dice.