Re: newbie question: define a variable?
Re: newbie question: define a variable?
- Subject: Re: newbie question: define a variable?
- From: "Marc K. Myers" <email@hidden>
- Date: Sat, 29 Dec 2001 02:41:01 -0500
- Organization: [very little]
>
Date: Wed, 26 Dec 2001 12:25:59 -0800
>
From: u7u <email@hidden>
>
To: email@hidden
>
Subject: newbie question: define a variable?
>
>
Hello list:
>
I am having trouble finding appleScript documentation on simple
>
activities like defining a variable. Any pointers to such documentation
>
would be appreciated.
>
>
The following gives an error "variable w not defined." I have tried
>
several different syntaxes, but I guess I'm not hitting the mark on
>
simply defining a variable.
>
>
any help greatly appreciated.
In AppleScript you define a variable by naming it and giving it a value.
set w to 0
copy 0 to w
Your script seems to assume that the variable "w" will be created with a
value of 0. AppleScript doesn't work that way. You can create a
property, a kind of persistent variable, with a property statement at
the top of the script, like this:
property w:0
Zero would be its initial value, but it will retain any value you might
give it later and retain it across executions of the script.
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[12/29/01 2:39:55 AM]