• 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: Oakley Masten <email@hidden>
  • Date: Wed, 15 Apr 2009 15:30:34 -0700 (PDT)

The obvious answer is: 


set Var1 to "Cat"

set Var2 to "Dog"

set Var3 to "Horse"

set Var4 to "Bird"


set ListAnimals to {Var1, Var2, Var3, Var4}


--Would Give   ListAnimals =  {"Cat","Dog","Horse","Bird"}

--Which is great if all Four Variables are always used.


--  BUT  IF


set Var1 to "Cat"

set Var2 to "Dog"

set Var3 to ""

set Var4 to "Bird"


set ListAnimals to {Var1, Var2, Var3, Var4}


--Would Give   ListAnimals =  {"Cat","Dog","","Bird"}

--I want       ListAnimals =  {"Cat","Dog","Bird"}



-- Later I want to add 

set Var5 to ""

set Var6 to ""

set Var7 to ""

set Var8 to ""

--etc.  and do not know how many or which will be used at any one time.



I fully realize that I could do it the first way and then filter

out the empty Var3.


All I wanted to know was if it was POSSIBLE to do it with the repeat command

and use a dynamically created variable name.


repeat with x from 1 to 4
copy (Var & x) to ListAnimals
end repeat


The answer appears to be NO if using only AppleScript.


To All of you for your responses on my question:

Thank you!


I have read each and every reply and appreciate the help provided.

As Always this users group is a great resource for information and support.


Oakley


 _______________________________________________
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: Copy to list Question
      • From: email@hidden
    • Re: Copy to list Question
      • From: Axel Luttgens <email@hidden>
    • Re: Copy to list Question
      • From: Skeeve <email@hidden>
    • Re: Copy to list Question
      • From: Peter Baxter <email@hidden>
    • Re: Copy to list Question
      • From: "Mark J. Reed" <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