Ever had punctuate a .doc document with HTML code?
It's a pain to say the least. I wrote this applescript code to take out a lot of the effort, it works for Word running on Mac computers, I can't test it on a PC. Save the code to the applescript folder under User>Documents>Microsoft User Data>Word Script Menu Items.
To use it, highlight the text in the word.doc, and run the script from the top menu bar on word.
I'd recommend <p> and </p> (or any non-punctation mark up) first, as it gets a little difficult to read 'speech' once the mark up takes place.
Notice there are two operations, the first replaces ';' terminates, then runs the rest of the code to avoid changing all the ';' in ASCII codes into meaningless gibberish.
/.....
Fixed - don't forget to remove blank spaces in the code
tell application "Microsoft Word"
set findRange to find object of selection
tell findRange
execute find find text ";" replace with "& # 5 9 ;" replace replace all
end tell
tell findRange
execute find find text "," replace with "& # 4 4 ;" replace replace all
execute find find text "." replace with "& # 4 6 ;" replace replace all
execute find find text "'" replace with "& # 3 9 ;" replace replace all
execute find find text "‘" replace with "& # 8 2 1 6 ;" replace replace all
execute find find text "’" replace with "& # 8 2 1 7 ;" replace replace all
execute find find text "-" replace with "& # 4 5 ;" replace replace all
execute find find text "—" replace with "& # 8 2 1 2 ;" replace replace all
execute find find text "“" replace with "& # 8 2 2 0 ;" replace replace all
execute find find text "”" replace with "& # 8 2 2 1 ;" replace replace all
execute find find text "…" replace with "& # 8 2 3 0 ;" replace replace all
execute find find text "?" replace with "& # 6 3 ;" replace replace all
execute find find text "!" replace with "& # 3 3 ;" replace replace all
execute find find text ":" replace with "& # 5 8 ;" replace replace all
end tell
end tell
...../
Have fun!
It's a pain to say the least. I wrote this applescript code to take out a lot of the effort, it works for Word running on Mac computers, I can't test it on a PC. Save the code to the applescript folder under User>Documents>Microsoft User Data>Word Script Menu Items.
To use it, highlight the text in the word.doc, and run the script from the top menu bar on word.
I'd recommend <p> and </p> (or any non-punctation mark up) first, as it gets a little difficult to read 'speech' once the mark up takes place.
Notice there are two operations, the first replaces ';' terminates, then runs the rest of the code to avoid changing all the ';' in ASCII codes into meaningless gibberish.
/.....
Fixed - don't forget to remove blank spaces in the code
tell application "Microsoft Word"
set findRange to find object of selection
tell findRange
execute find find text ";" replace with "& # 5 9 ;" replace replace all
end tell
tell findRange
execute find find text "," replace with "& # 4 4 ;" replace replace all
execute find find text "." replace with "& # 4 6 ;" replace replace all
execute find find text "'" replace with "& # 3 9 ;" replace replace all
execute find find text "‘" replace with "& # 8 2 1 6 ;" replace replace all
execute find find text "’" replace with "& # 8 2 1 7 ;" replace replace all
execute find find text "-" replace with "& # 4 5 ;" replace replace all
execute find find text "—" replace with "& # 8 2 1 2 ;" replace replace all
execute find find text "“" replace with "& # 8 2 2 0 ;" replace replace all
execute find find text "”" replace with "& # 8 2 2 1 ;" replace replace all
execute find find text "…" replace with "& # 8 2 3 0 ;" replace replace all
execute find find text "?" replace with "& # 6 3 ;" replace replace all
execute find find text "!" replace with "& # 3 3 ;" replace replace all
execute find find text ":" replace with "& # 5 8 ;" replace replace all
end tell
end tell
...../
Have fun!
Last edited: