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

Re: global variable not being recognized by script object subroutine


  • Subject: Re: global variable not being recognized by script object subroutine
  • From: Bill Planey <email@hidden>
  • Date: Tue, 27 Feb 2001 14:10:16 -0600

>on 2/27/01 12:16 PM, Bill Planey (email@hidden) wrote:
>
>(snip)
>
>> ... 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?
>
>I could be wrong, but - don't you also have to specify that AnyDesktop is a
>global in the loaded script object?
>
> global AnyDesktop
> display dialog AnyDesktop
>
If that's the case, I am severely misunderstanding what a "global"
variable
is supposed to be able to do (or the proper way of implementing it).
I am trying to save huge amounts of space by
setting my variables once. In the literature about AppleScript that I have
collected, as near as I can tell, declaring a global variable allows that
variable to be referred to later in any handler, script object, script
library,
etc., in that variable's correct meaning. AM I WRONG ABOUT
THIS??? If so, I need to be educated pronto about how to do what I at
least
HOPE to do with these variables, or I will not be able to create a
manageable
script.

I did another test, and moved the handler from the script object to a
physical
location within the master script (outside the on run/end run
statements). It
still didn't work when called.

I fear I am doing something wrong that betrays my relative beginner status
with AppleScript.

Thanks!

Bill Planey


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