• 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: Translate a code of 2 characters to a text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Translate a code of 2 characters to a text


  • Subject: Re: Translate a code of 2 characters to a text
  • From: Malcolm Fitzgerald <email@hidden>
  • Date: Tue, 7 May 2002 21:27:23 +1000

At 9:29 AM +0200 7/5/02, Olivier Berquin wrote:
Hi all,

I will receive a database wich contains about 9 fields. In one of these
fields, I have a 'code', like this:
CD, DVD, VHS, ...
I have about 80 'codes'. I must 'translate' this code in text like this:
CD = COMPACT DISC,
DVD = DIGITAL VERSATILE DISC
...

How can I 'translate' this code.
I wrote this (with 6 codes):

--
property ListOfMedia : {{"CD", "COMPACT DISC"}, ,
{"SA", "SUPER AUDIO"}, ,
{"MD", "MINI DISC"}, ,
{"MC", "MUSICASSETTE"}, ,
{"VH", "VIDEO"},,
{"DV", "DIGITAL VERSATILE DISC"}}

repeat with TheCounter from 1 to 6
if TheTypeOfMedia = item 1 of item TheCounter of ListOfMedia then
set TheTypeOfMedia to item 2 of item TheCounter of ListOfMedia
exit repeat
end if
end repeat
--


what about using a single list and a handler?

-----

property listOfMedia: {"CD","COMPACT DISC","SA", "SUPER AUDIO","MD", "MINI DISC","MC", "MUSICASSETTE","VH", "VIDEO"
,"DV", "DIGITAL VERSATILE DISC"}

set typeOfMedia to what_is(typeOfMedia)

on what_is (abbrev)
repeat with i from 1 to 11 by 2
if (abbrev is item i of listOfMedia) then return (item (i+1) of listOfMedia)
end repeat
end what_is

------


--
--
Malcolm Fitzgerald email@hidden
Database Manager http://www.asauthors.org
The Australian Society of Authors ph: 02 93180877 fax: 02 93180530
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Translate a code of 2 characters to a text
      • From: Matthew Stuckwisch <email@hidden>
References: 
 >Translate a code of 2 characters to a text (From: Olivier Berquin <email@hidden>)

  • Prev by Date: Re: Setting Default Browser in OS X
  • Next by Date: Re: More newbie queries: paths
  • Previous by thread: Translate a code of 2 characters to a text
  • Next by thread: Re: Translate a code of 2 characters to a text
  • Index(es):
    • Date
    • Thread