• 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: Replacing Codes with Text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replacing Codes with Text


  • Subject: Re: Replacing Codes with Text
  • From: Arthur J Knapp <email@hidden>
  • Date: Sat, 16 Jun 2001 13:57:49 -0400

> From: email@hidden
> Subject: Replacing Codes with Text
> Date: Fri, 15 Jun 2001 09:40:19 -0500


> The actual list would normally contain 15-20 codes out of a 175 different
> possibilities. Here is a short sample of the list I am dealing with.

> {"agn", "bal", "bmp", "bof"}

> I need to replace those items with:
> {"Agnes", "Baldo", "Speed Bump", "Mister Boffo"}


> Is there any way I could set up a text file with all 175 codes and what they
> equal, along the lines of:
> agn = Agnes
> bal = Baldo
> bmp = Speed Bump
> bof = Mister Boffo
> then have the script call it in as a variable and compare one list to the
> other and build a new list?

This is a vanilla method:

"abc = AaB bCc
def = DdE eFf
agn = Agnes
bal = Baldo
bmp = Speed Bump
bof = Mister Boffo
ghi = GgH hIi"
--
set CodeText to result -- ... to read alias "path:to:datafile"

-- Pretend the above is from your text file


set localCodes to {"agn", "bal", "bmp", "bof"}


-- any character unlikely to occur in the data:
--
set sentinal to ASCII character 1


repeat with i in localCodes

set text item delimiters to "" & i & " = "
set CodeText to text items of CodeText

if length of CodeText = 1 then
-- code was not found
else
set contents of i to paragraph 1 of item 2 of CodeText
end if

set CodeText to "" & CodeText -- restores CodeText, using same tids

end repeat

set text item delimiters to {""} -- restore

localCodes
-- > {"Agnes", "Baldo", "Speed Bump", "Mister Boffo"}



Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden

Hey, check out:
http://www.vivaladata.com


  • Follow-Ups:
    • Re: Replacing Codes with Text
      • From: Paul Berkowitz <email@hidden>
  • Prev by Date: Eudora mailbox folders
  • Next by Date: quitting Dock
  • Previous by thread: Re: Replacing Codes with Text
  • Next by thread: Re: Replacing Codes with Text
  • Index(es):
    • Date
    • Thread