Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Global variables



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:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/archives/applescript-users

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



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.