Re: Script Editor vs. Applet
Re: Script Editor vs. Applet
- Subject: Re: Script Editor vs. Applet
- From: Deivy Marck Petrescu <email@hidden>
- Date: Tue, 29 Jun 2010 09:45:18 -0400
On Jun 28, 2010, at 1:44 PM, Stockly, Ed wrote:
> Each time Script Editor runs it clears the values of globals and properties.
>
Ed,
this is not true.
Global values and properties are retained after each run.
Unless one recompiles the script, the values are kept.
Firstly, any variable declaration in the top level script is global, one does not need to declare it as such, in the top level.
Here is a script you can test and see it happening. Copy and paste in SE and run it many times without recompiling
<script>
try
set x to x + 1
on error
set x to 2
end try
x
</script>
> Each time you run your script as an applet, it retains those values. It
> sounds like each successive run is increasing the amount of memory used.
>
> Might be a good idea to try to reset values of properties or globals on
> launch, or, if possible, at the end of the run.
>
> Set myProp to {}
> or
> Set myProp to ""
This is a good idea both with applets and with scripts.
Anytime you declare a variable that might take "a lot of memory space" it is good to "empty it" afterwards.
Imagine if x in the script above was a tiff picture or a very long text....
>
> If there are values you want to access in your script you may write them to
> a file and read them as needed.
>
>
> ES
>
>
Deivy Petrescu
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:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden