Scripting MSWord
Scripting MSWord
- Subject: Scripting MSWord
- From: "Joseph A. Weaks" <email@hidden>
- Date: Sun, 7 Oct 2001 23:30:01 -0500
I have been writing some simple Applescripts for several text editors,
but when I write them for Word 98 on my G3 running 8.6, they run like
molasses. The scripts are simple, do visual basic find a pattern, copy
that pattern into a variable, activate my app that returns a new
variable, paste that variable into Word. But every VB line of this
code is so slow....and eventually crashes. Any ideas?
tell application "Microsoft Word"
activate
do Visual Basic " Selection.Find.ClearFormatting"
do Visual Basic " With Selection.Find
.Text = \"<[1-4a-zA-Z.]@[a-zA-Z .][0-9]{1,3}[:][0-9 \\-:.,f]{1,}\"
.Replacement.Text = \"\"
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
End With"
do Visual Basic " Selection.Find.Execute"
set theResults to (contents of selection)
do Visual Basic " Selection.MoveRight Unit:=wdCharacter, Count:=1"
set contents of selection to "
"
end tell
-- Go do do stuff with that variable, then return to Word to paste it in.
tell application "Microsoft Word"
activate
set contents of selection to theResults
set contents of selection to "
"
end tell
Thanks for any help,
Joe Weaks
--
* * * * * * * * * * * * * * * * * * * * *
Joe Weaks
A Bible, Greek, Mac, and Scripting Nut
* * * * * * * * * * * * * * * * * * * * *