Is there a way to code a string in one script, store it in a library file, and use that definition in a second script in a way that the string can be different on separate machines but all scripts loading it can work the same?
Let me explain.
One my desktop machine, I store all my source code for scripts in a folder on a partition of my hard drive that is not the startup volume. I have hard-coded the various folders containing scripts and libraries in all my sources.
However, I wish to move these same scripts to a different machine (a laptop) that doesn't have the same disk structure. I wish to code one script, library (or whatever), that can be loaded from a know location (i.e. the script folder in the user's domain) that would contain the hard-coded location of all other scripts and libraries for the machine its running on.
This would allow me to only have to maintain a single script file that points to all other paths for that specific machine.
Here is what I've tried:
In the Script folder of my home directory is this script, stored under the name DefineSource.scpt:
on GetSourceDef() return "HD2:Script Source:" end GetSourceDef
This one file would change for each machine, and establishes the location of all my source folders for that machine.
A second script looks like this:
set myScripts to ((path to scripts folder) in user domain) as text set DefSrc to myScripts & "DefineSource.scpt" load script alias DefSrc
set z to DefSrc's GetSourceDef() display dialog z
What I get when I run this script is the error message:
"OSX:Users:jimbrandt:Library:Scripts:DefineSource.scpt" doesn't understand the GetSourceDef message.
What am I doing wrong?
TIA, Jim Brandt
|