I want to search a word in InDesign CS2 document and change character style of the first result only.
Everything works except the last line :
tell application “Adobe InDesign CS2”
set find preferences to nothing
set change preferences to nothing
set theStyle to character style “SearchResult” of document 1
set searchResults to search documents with find attributes {find text:p_word}
set foundResult to item 1 of searchResults
set applied character style of text foundResult to theStyle
end tell
tell application “Adobe InDesign CS2”
set find preferences to nothing
set change preferences to nothing
set theStyle to character style “SearchResult” of document 1
set searchResults to search documents with find attributes {find text:p_word}
set foundResult to item 1 of searchResults
set properties of foundResult to {applied character style:theStyle}
end tell