• 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: g3pb <email@hidden>
  • Date: Tue, 27 Feb 2001 12:03:58 -0900

i believe this will demonstrate what you need. you will need to change the
path names in file1. each time file1 is run, the number will increase

-- file1

set LS to load script "pb0:desktop folder:temp:glob.as"
set valueNow to LS's aGlob
display dialog valueNow
set (LS's aGlob) to ((LS's aGlob) + 1)
store script LS in ,
"pb0:desktop folder:temp:glob.as" replacing yes

-- file 2

property aGlob : 1




-- hcir
mailto:email@hidden
Made with a Mac!


>> 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.


References: 
 >Re: global variable not being recognized by script object subroutine (From: Bill Planey <email@hidden>)

  • Prev by Date: Re: Replacing range within a string
  • Next by Date: folder action help
  • 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