Triggered Script Default File Selection Help

Here is what I’m trying to accomplish - Using the “as Three Panes” view, I want to select a group (triggering my script) in the leftmost of the three panes and have the script select a (fixed, or hard coded) file in the upper right pane (called “Default” in my example) causing it to be previewed in the lower right pane.

This is what I have so far -

on triggered(theRecord)
	display dialog "Yup, I'm executing"
		tell application id "com.devon-technologies.thinkpro2"
			set theSelection to the children of theRecord
			repeat with thisItem in theSelection
				if the name of thisItem is "Default" then
					display dialog "Found Default"
					set selection to thisItem
				end if
			end repeat
		end tell
	end try
end triggered

This works perfectly with the exception that it does not select the file, which, of course, is the purpose. I’m thinking it is a window focus problem in that “selection” is relative to the active window. This is where I am out of ideas. I suspect this is really simple but my brain is empty.

Ideas are appreciated.

Thanks - Gary

Here is my thinking. The Group represents a part, and is named with the part number. The files that make up the group are an image of the part (Default.jpg), and a Devonthink Sheet that contains dynamic information about the part such as quantity on hand, location, last cost etc. When I pick the part (group) I would like to immediately see the image of the part in the preview window (did I pick the 8 hole hub or the 6 hole?). As there might also be other files in the group, MSD sheet, data sheet, re-order form, etc. It seemed to make sense to automate the initial file selection when the group is opened.

I am, and have always been, a bit different, but I would think others would find the ability to select a default file for preview on opening a group to be beneficial. :slight_smile:

Selection is a read only property. Just tell it to open the record in a new window or tab.

Only the selection of the app is read-only but the selection of windows can be set.

In addition, the selection is a list. Therefore this might work:

set selection of think window 1 to {thisItem}

That works perfectly! Thank you.