Re: Date Variables that modify themselves! Huh?
Re: Date Variables that modify themselves! Huh?
- Subject: Re: Date Variables that modify themselves! Huh?
- From: "Serge Belleudy-d'Espinose" <email@hidden>
- Date: Wed, 4 Jul 2001 16:57:21 +0200
At 14:17 +0100 4/07/01, Guy Parker wrote:
>
In the example as written below the action of modifying one variable
>
(DateTimeSend) affects another variable (DateTimeNow) from which the first
>
was derived. If the line containing "--this fails" is replaced by the one
>
containing "--this works" then the action of modifying one variable does not
>
affect the other.
(
)
>
tell application "Finder"
>
set DateTimeNow to (current date)
>
set DateTimeSend to DateTimeNow --this fails
>
--set DateTimeSend to (current date) --this works
(
)
>
set time of DateTimeSend to DelayTime
By using the 'set y to x' construct, you're establishing some kind of connection - the applescript term is reference - between y and x, so that addressing y actually addresses x. This is not true for all kinds of variables, but this it true for lists, records, and others I forget. A date variable is more or less acting like a record, so modifying subportion of y actually modifies x.
You can avoid the reference thing like this:
set DateTimeNow to (current date)
copy DateTimeNow to DateTimeSend
Also, but not related to your problem, you don't need to use a 'tell app "Finder"' block.
Serge
--
\\//\//\// Serge Belleudy-d'Espinose Institut Jacques Monod
// // //
http://www.ijm.jussieu.fr/ Univ. Jussieu - Paris
//\//\//\\