re: Month as Integer (or he's ranting again)
re: Month as Integer (or he's ranting again)
- Subject: re: Month as Integer (or he's ranting again)
- From: "Jason W. Bruce" <email@hidden>
- Date: Mon, 04 Dec 2000 11:02:39 -0600
Nigel Garvey stated in part:
>
Not *any* "constant". You *can't* reassign values to months (Richard's
>
implication that you can is what kicked off this sub-thread), nor to
>
booleans or weekdays. Attempts to do so won't even compile (OS 8.6,
>
Script Editor). These constants are, in fact, constant.
>
. . . .
>
"Constants" such as pi, tab, days, [etc.] seem to be scriptwide
>
properties with default, compile time values. . . .
Hi Nigel,
I don't think you can use booleans as labels anywhere, but you can reassign
values to months, days, tab, and so-called constants if you place them in
records:
set foo to {December:December,tab:tab,monday:monday}
display dialog foo's December default answer ""
set foo's December to text returned of the result
display dialog foo's December -- displays whatever you entered
Records in AppleScript apparently have their own script context, and behave
like script objects. This means that you can use the same label in
different records in the same script, or the same label in a record and
elsewhere in a script -- even if the label is a so-called constant.
Jason Bruce