Re: Manipulating text
Re: Manipulating text
- Subject: Re: Manipulating text
- From: LuKreme <email@hidden>
- Date: Sun, 27 Sep 2009 00:49:42 -0600
On 26-Sep-2009, at 08:56, Jon Pugh wrote:
It'a not painfully obvious, in fact it's downright obtuse and has
confused people since the dawn of AppleScript.
If you've ever programmed in a language like C that uses pointer then
you can think of set as being a command for copying pointers and copy
being a command for data.
set OldVar to MyVar
means that MyVar and OldVar both point to the exact same data. If you
make changes to the data, then those changes will be reflected in both
MyVar and OldVar.
On the other hand, if you use
copy OldVar to MyVar
then each variable contains its own copy of the data. If you make
changes to the data in OldVar those changes will not carry over to
MyVar.
Now, the confusing part is that AppleScript will let you use either
command to initialize a variable with literal data.
set MyVar to "1234567890ABCDEF"
really means set MyVar to a pointer to the data I specified. But
copy "1234567890ABCDEF" to MyVar
means copy the literal data into memory and set a pointer to it, and
then name that pointer MyVar.
Same thing, only when it isn't.
--
*** Word_of_God was kicked from #christian by SageRider (Please
don't Swear)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden