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: "Arthur J Knapp" <email@hidden>
- Date: Sat, 31 Mar 2001 12:34:20 -0500
>
Date: Sun, 01 Apr 2001 02:51:52 +1000
>
Subject: is it possible to load a script library with a creation handler
>
From: Timothy Bates <email@hidden>
>
... 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?
>
set myStaircase to my createNewAdapativeStairCase({1,2,3})
>
>
returnParameters() of myStaircase
>
--> {1,2,3}
-- Complied Script File "StairCaseLib"
--
on createNewAdapativeStairCase(parameterList)
script staircase
property parameters: parameterList
on returnParameters()
return parameters
end returnParameters
end script
end createNewAdapativeStairCase
-- Main Script
--
property StairCaseConstructor : load script file "MacHD:Fold:StairCaseLib"
on run
tell StairCaseConstructor
set myStaircase to createNewAdapativeStairCase({1,2,3}) of it
end tell
returnParameters() of myStaircase
--> {1,2,3}
end
>
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.
-- Script File "Init & Load"
--
on run (arg)
script
property aVar : item 1 of arg
property bVar : item 2 of arg
property cVar : item 3 of arg
on showProps()
display dialog "" & aVar & bVar & cVar
end showProps
end script
end run
-- Main Script
--
set Lib to run script (alias "MacHD:Init & Load") with parameters {1, 2, 3}
Lib's showProps()
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
http://www.AppleScriptSourceBook.com