Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set stringToFind to "INT."
- set stringToReplace to "===
- INT."
- set theFile to choose file
- set theContent to read theFile as «class utf8»
- set {oldTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, stringToFind}
- set ti to every text item of theContent
- set AppleScript's text item delimiters to stringToReplace
- set newContent to ti as string
- set AppleScript's text item delimiters to oldTID
- set stringToFind to "EXT."
- set stringToReplace to "===
- EXT."
- set {oldTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, stringToFind}
- set ti to every text item of newContent
- set AppleScript's text item delimiters to stringToReplace
- set finalContent to ti as string
- set AppleScript's text item delimiters to oldTID
- try
- set fd to open for access theFile with write permission
- set eof of fd to 0
- write finalContent to fd as «class utf8»
- close access fd
- on error
- close access theFile
- end try
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement