• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: is it possible to load a script library with a creation handler
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: Help with validating a date input to a dialog
  • Next by Date: Re: CGIs with OSX
  • Previous by thread: Re: bugs, bugs, bugs
  • Next by thread: Re: is it possible to load a script library with a creation handler
  • Index(es):
    • Date
    • Thread