home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2000 June / APC561.ISO / workshop / other / mac / emdashscript.txt < prev    next >
Encoding:
Text File  |  2000-03-21  |  1.3 KB  |  28 lines

  1. set infile to (choose file with prompt "Input file?" of type "TEXT")
  2. set infileref to (open for access file "Macintosh HD:Desktop Folder:infile")
  3. set outfile to (new file with prompt "Output file?" default name "outfile")
  4. set outfileref to (open for access outfile with write permission)
  5. set starttime to current date
  6. copy (read infileref as list using delimiter return) to fileText
  7. close access infileref
  8. repeat with i from 1 to the number of items in fileText
  9.     repeat until not (item i of fileText contains "╤")
  10.         set foundOffset to offset of "╤" in (item i of fileText)
  11.         if foundOffset = 1 then
  12.             set stringStart to ""
  13.         else
  14.             set stringStart to text 1 thru (foundOffset - 1) of item i of fileText
  15.         end if
  16.         if foundOffset = the number of characters in (item i of fileText) then
  17.             set stringEnd to ""
  18.         else
  19.             set stringEnd to text (foundOffset + 1) thru (the number of characters in (item i of fileText)) of item i of fileText
  20.         end if
  21.         set item i of fileText to stringStart & "--" & stringEnd
  22.     end repeat
  23.     write (item i of fileText) & return to outfileref
  24. end repeat
  25. close access outfileref
  26. set endtime to current date
  27. display dialog (((the number of items in fileText) as string) & " lines processed in " & (endtime - starttime) as string) & " sec"
  28.