Re: A Lookup Function?
Re: A Lookup Function?
- Subject: Re: A Lookup Function?
- From: Bruce Robertson <email@hidden>
- Date: Mon, 24 Jan 2011 10:33:47 -0800
On Jan 24, 2011, at 10:15 AM, email@hidden wrote:
>
> On Jan 24, 2011, at 9:30am, Marconi wrote:
>
>> For example, I'd enter "email@hidden" and it would parse each character and pop up a window with the text:
>>
>> Mike Alpha Romeo Charlie Oscar November India at Mike Delta Charlie Charlie Lima X-ray X-ray Victor India dot Charlie Oscar Mike.
>>
>
> Here's a very simple way to do this in appleScript. May not be the most efficient, but it works.
> ----------------------
> property lookUpTable : ". dot
> @ at
> 1 one
> 2 two
> 9 nine
> a Alpha
> B Bravo
> c Charlie
> d Delta
> i India
> l Lima
> m Mike
> n November
> o Oscar
> r Romeo
> v Victor
> x X-ray
> Z Zulu
> "
> set sourceString to "email@hidden"
> set endString to {}
> set sourceString to items of sourceString
> repeat with thisKey in sourceString
> set the end of endString to LookUpData(thisKey)
> end repeat
> set AppleScript's text item delimiters to {"-"}
> set endString to endString as text
>
> display alert endString
> on LookUpData(key)
> set oldDelims to AppleScript's text item delimiters
> set AppleScript's text item delimiters to {key & tab}
> try
> set dataForKey to paragraph 1 of text item 2 of lookUpTable
> on error
> set dataForKey to ""
> end try
>
> set AppleScript's text item delimiters to oldDelims
> return dataForKey
> end LookUpData
> ----------------------
Might need a little work.
What if one of the keys is 1; and one of the keys is, for instance, 31?
_______________________________________________
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