• 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
global variable not being recognized by script object subroutine
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: global variable not being recognized by script object subroutine
      • From: Jolly Roger <email@hidden>
  • Prev by Date: Re: Write to file
  • Next by Date: Replacing range within a string
  • Previous by thread: Re: Fetch 3.0.3
  • Next by thread: Re: global variable not being recognized by script object subroutine
  • Index(es):
    • Date
    • Thread