global variable not being recognized by script object subroutine
global variable not being recognized by script object subroutine
- Subject: global variable not being recognized by script object subroutine
- From: Bill Planey <email@hidden>
- Date: Tue, 27 Feb 2001 12:16:20 -0600
I am having problems with variables I am setting as globals.
They seem not to be understood by the script files that load
(which refer to the global variables after they have been set).
For example, I have a script that starts "on run..."
and it sets a number of global variables before doing anything
else. Here is one:
global AnyDesktop
set AnyDesktop to path to desktop folder as string
-- opens the file where many global variables for file
-- and directory locations are set
set GlobalsFile to scriptFolder & "GlobalsHandler" as string
set GlobalsObject to (load script file GlobalsFile)
tell GlobalsObject
DoSubroutine()
end tell
... To test, I have a display dialog statment as the first line
of the DoSubroutine handler:
display dialog AnyDesktop
The script breaks with the following message:
"The variable AnyDesktop is not defined."
So, I thought it had been defined in the master script, but somehow
the handler in the script object is not getting this variable, even
though I gave it the "global" designation. What am I doing wrong?
Thanks!
Bill Planey