trigger script without opening record

When I attach a script to a file and I double click the file, DTP opens the file and triggers the script. Is there any way to just trigger the script and not open the file?

I was just playing around to see if I can use a script to open a file automatically in an external editor and then synchronize the result.

on triggered(theRecord)
		tell application "DEVONthink Pro"
			if type of theRecord is rtf then
				set v_file to (path of theRecord) as POSIX file
				tell application "TextEdit"
					open v_file
				end tell
				synchronize record theRecord
			end if
		end tell
	on error error_message number error_number
		display alert "DEVONthink Pro" message error_message
	end try
end triggered

No. But you could add a script to the scripts menu (see folder ~/Library/Application Support/DEVONthink Pro):

tell application "DEVONthink Pro"
	set theSelection to the selection
	repeat with theRecord in theSelection
		-- do something here
	end repeat
end tell

Then add a shortcut to the script (e.g. by using a name like “MyScript___Cmd-Option-T.scpt”) and you should be able to easily open the selection in TextEdit by pressing the shortcut.

Interesting possibility, but it doesn’t allow me to have lots of different scripts for different files or groups. I was thinking I could solve other application/DTP integration issues with scripts, like edit a database, reexport the database content, synchronize a DTP index of the database export file. With triggered scripts, I could have a bunch of different export files from a single database, each containing different portions of the database and indexed independently for DTP searching.

This would help with applications like OmniOutliner. A single outline can be huge with many sections. Being able to break the contents of a large outline up with scripts for DTP searching would make integration with DTP more useful.

Perhaps DTP could just trigger the script with option-doubleclick or option-open?

That might be a possibility but I don’t think spending time on workarounds is a good idea as v2.0 of DT Personal/Pro will change a lot of the current shortcomings.

Thanks for this suggestion,
I am enjoying using DevonThink greatly but need to be able to fold my text documents… hence JEdit.
I’m very new to AppleScript… was wondering if this script has worked out to keep the file synchronized?