Guest User

Split Fountain Scenes

a guest
Nov 27th, 2016
394
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set stringToFind to "INT."
  2. set stringToReplace to "===
  3. INT."
  4.  
  5. set theFile to choose file
  6. set theContent to read theFile as «class utf8»
  7. set {oldTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, stringToFind}
  8. set ti to every text item of theContent
  9. set AppleScript's text item delimiters to stringToReplace
  10. set newContent to ti as string
  11. set AppleScript's text item delimiters to oldTID
  12.  
  13. set stringToFind to "EXT."
  14. set stringToReplace to "===
  15. EXT."
  16. set {oldTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, stringToFind}
  17. set ti to every text item of newContent
  18. set AppleScript's text item delimiters to stringToReplace
  19. set finalContent to ti as string
  20.  
  21. set AppleScript's text item delimiters to oldTID
  22.  
  23.  
  24. try
  25.     set fd to open for access theFile with write permission
  26.     set eof of fd to 0
  27.     write finalContent to fd as «class utf8»
  28.     close access fd
  29. on error
  30.     close access theFile
  31. end try
RAW Paste Data