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: resetting script between runs



Luther Fuller wrote on Mon, 4 Jun 2007 07:26:31 -0500:

>Globals ARE persistent. Values ARE saved between runs. Save this as
>an application ...
>
>on run
>	global runNr
>	try
>		set runNr to (runNr + 1)
>	on error
>		set runNr to 1
>	end try
>	display dialog runNr buttons {"OK"}
>end run

And "top level" variables count as globals in this respect. If the
'global' declaration above is omitted, runNr still increments over runs.

I think there was a bug in the earlier versions of Tiger, whereby globals
and properties _didn't_ persist. But that's been fixed for a while now.

To "remove garbage from a script between runs", you can set its globals
to less bulky values (eg. "") before it finishes, or, preferably, use
locals instead.


NG

 _______________________________________________
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



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.