• 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: Date Variables that modify themselves! Huh?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
//\//\//\\


References: 
 >Date Variables that modify themselves! Huh? (From: Guy Parker <email@hidden>)

  • Prev by Date: "Size of Finder Selection" for Mac OSX
  • Next by Date: Re: Suggestions for improvements to scripting QuarkXPress ...
  • Previous by thread: Re: Date Variables that modify themselves! Huh?
  • Next by thread: Re: Date Variables that modify themselves! Huh?
  • Index(es):
    • Date
    • Thread