Trying to script MS Word is driving me to slay the faceless beast. ARRRGHH!!
Sorry. Latest conundrum:
I'm trying to search for, select, and modify text in documents. The documents are formatted like this:
- word count - <empty line> - title - <empty line> -body text paragraph 1 - <empty line> - body text paragraph 2 -
....and so forth.
The problem is that I want to exclude the title from the search. Figuring that each Word counts each line as a paragraph, I've tried to set the insertion point to the beginning of the body text and search forward:
tell application "Microsoft Word" set wholeStory to (create range active document start 0 end (count of characters in active document)) set wholeStoryText to content of wholeStory
--set start of selection to first character of active document set selection's selection start to (first character of paragraph 5 of wholeStoryText) set selection's selection end to (first character of paragraph 5 of wholeStoryText) set selFind to find object of selection set content of selFind to "foo" set forward of selFind to true execute find selFind
end tell
But it always starts seraching from the beginning of the document no matter what I do. How do I tell this silly program to start searching from somewhere other than the beginning?
I know this is a very powerful AS implementation, but it is cryptic and not well documented. Feh!
Larry the O |