Re: trying to build text in an applescript to point to a variable
Re: trying to build text in an applescript to point to a variable
- Subject: Re: trying to build text in an applescript to point to a variable
- From: Eric C Saunders <email@hidden>
- Date: Fri, 12 Sep 2008 14:44:27 -0400
You can not form a variable on the fly.
Try this:
set NounToUse to "Hoover"
set {AList, BList, CList, DList, EList, FList, GList, HList, IList, JList,
KList, LList, MList, NList, OList, PList, QList, RList, SList, TList, UList,
VList, WList, XList, YList, ZList} to {{}, {}, {}, {}, {}, {}, {}, {"Hankering",
"Horrible", "Helping handed", "Harping",
"Hardboiled", "Hairbrained", "Hippity Hoppity",
"Hatchet nosed"}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
{}, {}, {}, {}, {}, {}, {}}
set letter_ to (the first character of NounToUse)
set letter to offset of letter_ in "abcdefghijklmnopqrstuvwxyz"
set TheListToUse to item letter of {AList, BList, CList, DList, EList,
FList, GList, HList, IList, JList, KList, LList, MList, NList, OList, PList,
QList, RList, SList, TList, UList, VList, WList, XList, YList, ZList}
set the list_count to the count of TheListToUse
set pick to random number from 1 to list_count
set AdjectiveToUse to item pick of TheListToUse as string
return AdjectiveToUse & " " & NounToUse
You can fill in the empty braces with the other adjective lists, or define
each list separately.
HTH,
Eric
On 09/12/2008 at 02:18:19pm PMDavid wrote:
> I am looking to choose a variable based on some user input. I thought
> it would be most efficient via something like what I have below, but
> it is not working for me, and I have not found a good way to get it
> to actually do what I want. Rather than get one of the items from
the
> list that exists (what I want) I get a random letter from the name
of
> the list. I can fully see why this is happening, but I am not seeing
> a way around this. If this is not possible, I can go the about the
> longer way of aiming at the list, but that will be sort of a pain
> with 26 lists to choose from.
>
>
>
> set NounToUse to "Hoover"
>
> set TheListToUse to (the first character of NounToUse) & "List"
>
> set HList to {"Hankering", "Horrible", "Helping
handed", "Harping",
> "Hardboiled", "Hairbrained", "Hippity Hoppity",
"Hatchet nosed"}
>
> set the list_count to the count of TheListToUse
> set pick to random number from 1 to list_count
> set AdjectiveToUse to item pick of TheListToUse as string
>
> return AdjectiveToUse & " " & NounToUse
>
> --Thanks for any help you can give....
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> 40meadwestvaco.com
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
This electronic message contains information from MeadWestvaco Corporation or
subsidiary companies, which may be confidential, privileged or otherwise protected
from disclosure. The information is intended to be used solely by the recipient(s)
named. If you are not an intended recipient, be aware that any review, disclosure,
copying, distribution or use of this transmission or its contents is prohibited. If you
have received this transmission in error, please notify MeadWestvaco immediately
at email@hidden.
_______________________________________________
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