Bug or stupid scripter? Help! [Data sharing; set vs copy]

Look at how x and y is set to the 22nd and 21st respectively, then read to the “get” stuff run it, then please explain why-oh-why

set z to x

set day of z to y

alters the value of x?

It’s as if y wanders up the script from z to x.

I’m going crazy with this.

set x to date "tisdag 22 januari 2008 00.00.00"

set y to (date "måndag 21 januari 2008 00.02.00")

set z to x

set day of z to day of y

get "x\t" & x & "\r\r" & "z\t" & z & "\r\r" & "y\t" & y

-->"x	måndag 21 januari 2008 00.00.00

z	måndag 21 januari 2008 00.00.00

y	måndag 21 januari 2008 00.02.00"


(Edited with variables that are easier to keep track of.
Edit 2 even further simplified)

Welcome. :slight_smile:

You changed the value of z, but z and x share the same value, so accessing x returns the value that you changed earlier (as it should). This is precisely the kind of situation where you want to use AppleScript’s copy command.

copy x to z

See also: Data Sharing

Awesome help. Never heard of the copy command.

Thanks a lot!