Word crashing sometimes on find and replace
Word crashing sometimes on find and replace
- Subject: Word crashing sometimes on find and replace
- From: "Dr Digby L. James" <email@hidden>
- Date: Sun, 7 Mar 2010 10:16:59 +0000
I like using the old style numbers in documents, usually using Bembo Std as this is an OpenType font that has them. For Microsoft Word 2004 I had a script to do this but it was erratic, it would sometimes work and sometimes cause Word to freeze. I searched around and created a new one which seemed to work perfectly - till today, when Word has frozen again, requiring a force quit. Being no expert, I can't see what's wrong. The script is:
_____________________
myReplaceText("0", "")
myReplaceText("1", "")
myReplaceText("2", "")
myReplaceText("3", "")
myReplaceText("4", "")
myReplaceText("5", "")
myReplaceText("6", "")
myReplaceText("7", "")
myReplaceText("8", "")
myReplaceText("9", "")
display dialog "Script completed"
on myReplaceText(myfind, myreplace)
tell application "Microsoft Word"
set findRange to find object of selection
set name of font object of findRange to "Bembo Std"
tell findRange
execute find find text myfind replace with myreplace replace replace all
end tell
end tell
end myReplaceText
_____________________
The log gives the following:
tell application "Microsoft Word"
get find object of selection
--> find id 5.92697E+8 of selection
set name of font object of find id 5.92697E+8 of selection to "Bembo Std"
Result:
error "Microsoft Word got an error: AppleEvent timed out." number -1712
I just had a thought, as I was typing, was that when I ran this just now I had no text selected. When I restarted Word I selected all and ran it and it worked. If this is the problem (by why, as it has worked before), what changes do I need to make to the script to search the whole document?
Dr Digby L. James
Quinta Press
Meadow View
Weston Rhyn
Oswestry
Shropshire
England
SY10 7RN
(44)(0)1691 778659
http://www.quintapress.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden