I have several script libraries with handlers to do things in specific applications (e.g., QuarkXPress_lib.scpt, Finder_lib.scpt, etc.) and a common library with generic handlers. What I need to do is create a script that loads an application-based script library and is able to globally share routines with it from the common library. I am looking to do this without passing the entire common library to the application library each time. In other words, I am looking to do this:
--Saved in Finder_lib.scpt
on do_something()
set x to name of startup disk
tell common_lib to return do_something_else(x)
end do_something
--Saved in Common_Lib.scpt
on do_something_else(x)
display dialog "The value is " & (x as string)
end do_something
--Third Script
property finder_lib : load script "Finder_lib.scpt" as alias
property common_lib : load script "Common_Lib.scpt" as alias
tell finder_lib to do_something()
Now I know I could put “property common_lib : load script “Common_Lib.scpt” as alias” into Finder_lib.scpt but then I’m loading it twice. I know I could also pass it to Finder_lib.scpt by placing “common_lib” into the parameters of the do_something handler: “do_something(common_lib)” but is there a better way to load Common_Lib.scpt once and have it available to all my other script libraries?
Thanks,
Jon