• 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 variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Global variables


  • Subject: Re: Global variables
  • From: Axel Luttgens <email@hidden>
  • Date: Thu, 08 Mar 2007 17:23:41 +0100

On 8/03/07 17:02, Larry the O wrote:

OK, I must be misunderstanding something really basic here.

All I'm trying to do is create a droplet that starts out by declaring and initializing a bunch of global variables, then runs a series of subroutine calls to do the work. The idea of using the global variables is so that the subroutines can read and write the global variables without them having to be explicitly passed in the subroutine call, right?

Not working. It worked when I was writing the code and running it directly from the script window, but once I added the droplet front end (which was independently tested and seems to work fine), the global variables are no longer working.

The actual code is kind of messy right now, so, for the moment, makePretend code:

on open

global littleMess
global bigMess
global ohMiGod

[...]


Could you try by putting the global statements outside but in front of the open handler:

   global littleMess
   global bigMess
   global ohMiGod

   on open

   [...]

On the other hand, perhaps properties would be more appropriate here.
(globals are very strange beasts in AppleScript and, for legibility reasons, should be avoided whenever possible)


HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Global variables (From: Larry the O <email@hidden>)

  • Prev by Date: Global variables
  • Next by Date: Re: Global variables
  • Previous by thread: Global variables
  • Next by thread: Re: Global variables
  • Index(es):
    • Date
    • Thread