• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Variable Tendencies
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Variable Tendencies


  • Subject: Re: Variable Tendencies
  • From: deivy petrescu <email@hidden>
  • Date: Sun, 2 Apr 2006 20:54:55 -0400


On Apr 2, 2006, at 18:23, Mark J. Reed wrote:


First, it's not a stupid question. What you're talking about is called "persistence". AppleScript variables are not persistent.

I agree with the first assertion, it is not a stupid question, but I disagree with the fact that AppleScript variables are not persistent, they are...


Try this at home:
Open SE(*) type the following script
<script>
try
	set x to x + 1
on error
	set x to 1
end try
</script>
keep pressing the run button:

--> 1,2,3,4,...

So yes, variables are persistent.
Important to keep in mind principally if you set a variable to read a large file,
better set the variable to "" after the run.




AppleScript *properties* are persistent, but only within a single script (so if you run the same script later it remembers the property values from the last time it was run). If you want one script to store a value for a different script's use, then you have to use some sort of explicit persistence mechanism: write it into a file, store it in a database, that sort of thing.


(*) Note: If one uses Smile, then the variable is persistent across script and runs




Deivy

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Variable Tendencies
      • From: Christopher Nebel <email@hidden>
References: 
 >Variable Tendencies (From: Jack Crombie <email@hidden>)
 >Re: Variable Tendencies (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: Variable Tendencies
  • Next by Date: Re: Quicktime : save export settings problem
  • Previous by thread: Re: Variable Tendencies
  • Next by thread: Re: Variable Tendencies
  • Index(es):
    • Date
    • Thread