I’m trying to count the number of non-breaking hyphens in a word document. The reason is, I’m replacing those non-breaking hyphens with regular hyphens with AppleScript, but I’d like to have a count of how many were found in the documents. Right now, the only value I can get is if the execute find is true or false, but not the number of items it found. If you do the same thing with the user interface, you get the number of found item, so there must be a way to get that, but I can’t seem to find it.
Here’s what I’ve got:
tell application "Microsoft Word" set myResult to find object of selection set myFinditem to execute find myResult find text "^~" wrap find find continue replace with "-" replace replace all if myFinditem is true then display dialog "There were some non-breaking space in the document." buttons "OK" default button "OK" else display dialog "There were NO non-breaking space in the document." buttons "OK" default button "OK" end if end tell
Thanks for any help:-)