How to select a record/document with script

Hi

I have written a simple GUI script to isolate and expand the currently selected group in DTP and select all the resulting groups.

I would then like to sort all of the records/documents that show in the Three Pane View by “Spotlight Comment”. I have written the part to do the sorting, but can’t work out how to select one of the documents in the right Pane so that the sorting is applied to the documents rather than the groups.

Could someone help me with the missing step?

Thanks

Nick

tell application "DEVONthink Pro"
	activate
end tell

tell application "System Events"
	tell process "DEVONthink Pro"
		tell menu bar 1
			
			tell menu bar item "Go"
				tell menu "Go"
					click menu item "Selected Group"
				end tell
			end tell
			
			tell menu bar item "Edit"
				tell menu "Edit"
					click menu item "Select All"
				end tell
			end tell
			
			tell menu bar item "View"
				tell menu "View"
					tell menu item "Sort"
						tell menu "Sort"
							click menu item "by Spotlight Comment"
						end tell
					end tell
				end tell
			end tell
			
		end tell
	end tell
end tell

Assuming that the groups have the focus initially, then you could simulate the shortcut Ctrl-Tab:


tell application "System Events"
	keystroke tab using control down
end tell

thanks, that works fine