• 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
Texand Lists Continued
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Texand Lists Continued


  • Subject: Texand Lists Continued
  • From: Peter Baxter <email@hidden>
  • Date: Wed, 02 Sep 2009 20:11:46 +1000

I have been using this script to create a comma delimited list that allocates teachers to their classes for import into a database.  I am nearly there, however the resulting list has lots of quotation marks in it.  Can someone please help me clean this up?

The result:
{"
", "ADA", "SCI7B", "SCI7G", "SCF10B", "
", "AND", "IP7B", "DRA7G", "DRA7O", "IP8B", "ART8O", "ART8R", "ART9B", "COMP", "
", "BAP", "MUS7B", "MUS8B", "MUS8G", "MUS9A", "2ND", "
", "
", "BAS", "FRE7B", "FRE7G", "FRE7O", "FORM8B", "FRE8B", "HUM8G", "FRE8R", "2ND", "
", "BRE", "CAR10A", "CAR10B", "CAR10C", "
", "BRP", "MAT9G", "NUM9A", "2ND", "

What I would like:

{ADA, SCI7B, SCI7G, SCF10B, 
AND, IP7B, DRA7G, DRA7O, IP8B, ART8O, ART8R, ART9B, COMP, 
BAP, MUS7B, MUS8B, MUS8G, MUS9A, 2ND, 
BAS, FRE7B, FRE7G, FRE7O, FORM8B, FRE8B, HUM8G, FRE8R, 2ND, 
BRE, CAR10A, CAR10B, CAR10C, 
BRP, MAT9G, NUM9A, 2ND, …...

The current script:

set theFile to POSIX file "/Users/peterba/Desktop/teacher loads 09_2.txt"
set includedFile to POSIX file "/Users/peterba/Desktop/subject codes 09_2.txt"
set teacherCodes to POSIX file "/Users/peterba/Desktop/teacher codes 09_2.txt"
--
try
set fileRef to open for access includedFile
set includedlist to read fileRef
set includedWords to every word in includedlist
close includedFile
end try
try
set fileRef to open for access teacherCodes
set includedStaff to read fileRef
set includedWords to includedWords & (every word in includedStaff)
close teacherCodes
end try
try
set fileRef to open for access theFile
set textTo to read fileRef
set myWords to {}


repeat with myWord in words of textTo
if myWord is in includedStaff then copy return to the end of myWords
if myWord is in includedWords then copy contents of myWord to the end of myWords
end repeat
on error errString
display dialog "There was an error reading the file because:" & errString ¬
buttons {"OK"}
return
end try
myWords
 _______________________________________________
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

  • Follow-Ups:
    • Re: Texand Lists Continued
      • From: Christopher Nebel <email@hidden>
    • Re: Texand Lists Continued
      • From: Michelle Steiner <email@hidden>
    • Re: Texand Lists Continued
      • From: Yvan KOENIG <email@hidden>
  • Prev by Date: get program name on start
  • Next by Date: Re: Texand Lists Continued
  • Previous by thread: Re: get program name on start
  • Next by thread: Re: Texand Lists Continued
  • Index(es):
    • Date
    • Thread