• 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: Copy to list Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Copy to list Question


  • Subject: Re: Copy to list Question
  • From: Paul Scott <email@hidden>
  • Date: Tue, 14 Apr 2009 18:36:45 -0700

I assume that the exercise was to try to coerce a string into a variable name. This is typically done to create and access arrays in some scripting languages that don't directly support them. To my knowledge, AppleScript doesn't allow such coercions, but then again it has lists. The correct way would be to start with a list in the first place, which obviates the need to coerce text into a variable name:

set myList to {"Cat", "Dog", "Horse", "Bird"}

then you could access individual items for copying to another list with something like you presented:

set ListAnimals to {}
repeat with x from 1 to count of myList
copy item x of myList to end of ListAnimals
end repeat
ListAnimals

Although, if you intended to copy all items you'd just use:

set ListAnimals to myList

Or, if all you wanted was the list:

myList

Paul

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

References: 
 >Fwd: Copy to list Question (From: Peter Baxter <email@hidden>)

  • Prev by Date: Re: Copy to list Question
  • Next by Date: Re: Copy to list Question
  • Previous by thread: Re: Copy to list Question
  • Next by thread: Re: Copy to list Question
  • Index(es):
    • Date
    • Thread