• 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: Manipulating text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Manipulating text
      • From: email@hidden
References: 
 >Manipulating text (From: Jim Brandt <email@hidden>)
 >Re: Manipulating text (From: Luther Fuller <email@hidden>)
 >Re: Manipulating text (From: Philip Aker <email@hidden>)
 >Re: Manipulating text (From: Luther Fuller <email@hidden>)
 >Re: Manipulating text (From: "Mark J. Reed" <email@hidden>)
 >Re: Manipulating text (From: Philip Aker <email@hidden>)
 >Re: Manipulating text (From: "Mark J. Reed" <email@hidden>)
 >Re: Manipulating text (From: Jon Pugh <email@hidden>)
 >Re: Manipulating text (From: Jon Pugh <email@hidden>)

  • Prev by Date: Re: AS Application
  • Next by Date: Re: AS Application
  • Previous by thread: Re: Manipulating text
  • Next by thread: Re: Manipulating text
  • Index(es):
    • Date
    • Thread