I want to make a auto-cue / text follow in MS word with applescript.
So i want the document to fysically go the the text what automatically is going in to the applescript.
here is the script i’m working with now:
tell application "Microsoft Word"
activate
if not (exists active document) then
display dialog "Er is geen actief document."
return
end if
set myFind to find object of text object of active document
set properties of myFind to {match case:false, match whole word:false, match wildcards:false, forward:true}
set content of myFind to prefix & CueText & posix
display dialog content of myFind as string
set foundRange to execute find myFind
if foundRange is not equal to missing value then
select object of foundRange as string
else
display dialog "Tekst niet gevonden."
end if
end tell
but:
find myFind
returns “true” and not the position of the text i’m searching for
Also “select” doesn’t work because of this but could not really find explanation in the documentation:
select object of foundRange
returns error "object of true kan niet worden opgevraagd. " number -1728 from object of true
(translation: The object of true cannot be retrieved.)
select object of foundRange as string
returns: error "object of true kan niet in type string worden omgezet." number -1700 from object of true to string'
(translation: The object of true cannot be converted to type string.)
but thats logical because its a true/false state.
I’m only not sure how to solve to get the position of the found text….
thierry wilders is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.