Re: global variables
Re: global variables
- Subject: Re: global variables
- From: Stan Cleveland <email@hidden>
- Date: Wed, 17 Jul 2013 13:48:23 -0700
On Jul 17, 2013, at 1:27 PM, Kaydell Leavitt wrote: I tried a global variable with the following code.
global x set x to 2 set x to x + 1 display dialog "x: " & x
It always displays 3 as the result.
Hi Kaydell,
Yes, it always displays 3, because you redefine x each time the script is run. Try this version, which defines x only during the first run:
global x try x on error set x to 2 end set x to x + 1 display dialog "x: " & x |
_______________________________________________
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