Re: A Lookup Function?
Re: A Lookup Function?
- Subject: Re: A Lookup Function?
- From: Luther Fuller <email@hidden>
- Date: Mon, 24 Jan 2011 13:24:22 -0600
On Jan 24, 2011, at 11:30 AM, Marconi wrote: Is there a lookup function in AppleScript that will look in a list of values (a table?) and get a corresponding value?
It seems that you are looking-up a word associated with a single character. So, why not use the id of the character to calculate an index for a list? Like this ...
property phoneticList : {"Zero", "One", "Two", "Three", "Four"}
on run set charIndex to my getCharIndex("2") if charIndex > 0 then item charIndex of phoneticList end if end run
on getCharIndex(theChar) set charID to (id of theChar) if (97 ≤ charID) and (charID ≤ 122) then return (charID - 32 - 47) if (48 ≤ charID) and (charID ≤ 57) then return (charID - 47) if (65 ≤ charID) and (charID ≤ 90) then return (charID - 47) return 0 end getCharIndex
You will have to complete the list phoneticList .
|
_______________________________________________
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