This Microsoft Word Applescript has recently returned false or crashes Microsoft Word when it is run in a long applescript.
tell application "Microsoft Word"
set theFind to find object of selection
-->find id «data iWio00638A0080600000» of selection
tell theFind
clear formatting
-->clear formatting find id «data iWio00638A0080600000» of selection
set forward to true
-->set forward of find id «data iWio00638A0080600000» of selection to true
set wrap to true
-->set wrap of find id «data iWio00638A0080600000» of selection to true
set content to ContentToFind
-->set content of find id «data iWio00638A0080600000» of selection to "Evaluation Date"
end tell
set theFind to find object of selection
-->find id «data iWio00638A0080600000» of selection
set execute_find to execute find theFind
-->execute find find id «data iWio00638A0080600000» of selection
-->false
end
The execute find applescript function has worked in the past, in the same script, returning true, and without crashing the Word application.
The identical execute find applescript function currently returns true when run in a short Applescript and does not crash the Word application
The find function also currently works in Microsoft Word’s application Find Dialog Window and returns a selected text.
- Is it possible that the length of an applescript causes some disruption in either Applescript’s or Word’s engines, leading to a false response rather than an otherwise true response, or to crashing the target application?
- If so, how do I resolve this problem?
Model: MacBook Pro
AppleScript: 2.5
Browser: Safari 600.5.17
Word: 16.15
Operating System: Mac OS X (10.12.6 beta 6)