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



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

(*
on quit
	global runNr
	set runNr to 0
	continue quit
end quit
*)

You will find that every time you launch it, the value displayed will increment. If you want to "collect garbage", enable the 'quit' handler.

On Jun 4, 2007, at 4:09 AM, Håvard Graudo wrote:

How do I remove garbage from a script between runs?

I have a fairly complex script that sometimes fails. Freshly saved as an application it is 308k large. After a run it may be 544k.

Problem is it sometimes fails, and I cannot debug:
If I open it in an editor and just recompile it will always work again.
If it fails contantly as an application and I just open and run it directly from an editor it will also work.


I think I must reset something between runs, but what? Are there anything else than properties that should be saved between runs?

My 4 properties are three booleans (ie. debug: false) + a static string (path to a logfile).
I have three globals. Globals are not saved between runs, right?


Any advise in strategy to choose? How do I get to see what actually fails. (The script may run fine for weeks after a compile.)

Håvard

---















_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript- 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

_______________________________________________ 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: 
 >resetting script between runs (From: Håvard Graudo <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.