InDesign Find/Change - Capture populated text

Not very optimistic about this.

Using InDesign CS2 I am trying to capture the information that may be stored in the Find/Change field.

The reason why.

I have to clear the preferences of the find/change, i.e.,

tell application “Adobe InDesign CS2”
set find preferences to nothing
set change preferences to nothing

That statement allows me to perform a search for a particular word such as “Hello” within the script.

The problem is, the operator may used something in the Find/Change field (prior to running the script) such as a date range that they will often be used again on another page. (sounds trivial but not for us)

I was getting complaints on my script because after it runs, the Find/Change field is populated with “Hello” rather than the last item they entered.

Is there a way to capture the previous Find/Change information before I run the major guts of my script? I tried system events. That’s very close, since I can open the Find/Change and Copy what’s in the field. BUT. I don’t know how to systematically close the Find/Change dialog box, which would be the same as hitting the “Done” button.



This should work:

tell application "Adobe InDesign CS2"
	set FindText to find text of find preferences
	set changeText to change text of change preferences
end tell

You are a life saver! And to top it off it is only one or two lines of code. I can’t believe this, and it works!


For the heck of it le’s make it one line:

tell application "Adobe InDesign CS2" to copy {find text of find preferences, change text of change preferences} to {FindText, changeText}