{"
", "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