Re: Variable Tendencies
Re: Variable Tendencies
- Subject: Re: Variable Tendencies
- From: "Mark J. Reed" <email@hidden>
- Date: Sun, 2 Apr 2006 18:23:27 -0400
> If I set a variable in a script when the script ends will the variable's
> value remain stored somewhere for a script that is run later to use. Is this
> the default behavior or do I have to save the variable's value in a file
> somewhere?
First, it's not a stupid question. What you're talking about is
called "persistence". AppleScript variables are not persistent.
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.
The file option is easiest. But you have to do it somewhat manually:
pick a name for the file, open the file for writing (from the first
script), write the value to it. Then the later script has to know the
filename, open it for reading, and read the value in.
> Also i haven't found a command to prompt for text input from the user in a
> dialog box.
The "display dialog" command will do that:
set answer to (display dialog "question?" default answer "no")
It's not obvious, but simply specifying a "default answer" causes
"display dialog" to accept user input.
--
Mark J. Reed <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:
This email sent to email@hidden