Saving the Results of a Search?

Hi-

I’d like to be able to save the results of a search as a text file. That is, the part of the search that returns the names of the files stored in a DTPO database, the listing in the search window. I believe there’s no menu selection that does this.

I know/presume I could write an Applescript to do this, but does one exist already?

Thanks, Charles

OK, I got this:


tell application "DEVONthink Pro"
	set searchresults to selection as list
	set textfile to ""
	set myfilename to name of search window 1 & ".txt"
	repeat with i in searchresults
		set textfile to textfile & name of i & linefeed
	end repeat
	create record with {name:myfilename, type:txt, plain text:textfile}
	-- set result to textfile
end tell

Which works with an open search window. (Not a lot of defensive programming here.) Any comments appreciated.

I’m curious whether there’s a DTPO way to get the search term from the input field? I know you could do this:


activate application "DEVONthink Pro"
tell application "System Events"
	tell process "DEVONthink Pro"
		get value of text field 1 of group 3 of tool bar 1 of window 1
	end tell
end tell

Right now I’m setting the resultant filename with the search window name. Obviously, I could massage that into anything, or could get the search terms directly from the input field.

Thanks, Charles

No, GUI scripting is the only solution.