• 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: "Mark J. Reed" <email@hidden>
  • Date: Wed, 15 Apr 2009 18:45:43 -0400

So you want to have a list of indeterminate size.  I still don't know
why you don't just use a list in the first place.  What do the
intervening variables get you?

If you want different parts of the code to selectively add to the
list, they can just do

set end of ListAnimals to "Cat"
...
set end of ListAnimals to "Horse"
...

etc.  If you want to add strings only if they're not empty, maybe a
handler is the solution:

property ListAnimals : {}

on maybeAdd(animalName)
	if animalName is not "" then
		set end of ListAnimals to animalName
	end if
end maybeAdd

maybeAdd("Cat")
maybeAdd("Dog")
maybeAdd("")
maybeAdd("Bird")

ListAnimals  -- returns {"Cat", "Dog", "Bird"}
 _______________________________________________
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: 
 >Re: Copy to list Question (From: Oakley Masten <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