Attached scripts will not execute

I am at my wits’ end, again. I am trying to get a script–any script–to run as a triggered script. I followed all of the instructions in the help:

I have tried several of the example scripts, and none execute. As the most simple test that I can imagine, I saved this into my ~/Library/Application Support/DEVONthink Pro 2/ Scripts folder as “Test Triggered Script.scpt”:

tell application id "com.devon-technologies.thinkpro2"
	display alert "It works!"
end tell

The script runs fine when invoked from the DTP Scripts menu.

I created a group named “Test Attached Script” and followed the instructions to attach the script to this group. The AppleScript graphic is displayed at the right of the group’s name. (See the attached screen shot.)

I change the focus from this group to another, and then back to the “Test Attached Script” group again. Nothing happens. I double-click the group to display it in a new window. Nothing happens. I change the view to any view other than a Split view, and back to a Split view. Nothing happens. I try attaching the script to a document in the group, and repeat all of these tests. Nothing happens. I remove the script from the group, leaving it attached to the document, and repeat all of these tests. Nothing happens. I delete the script completely, and the group, and quit DTP, start it again, and repeat all of these tests. Nothing happens. I uninstalled DTP (paying meticulous attention to the multiple steps required as documented in the help pdf), restarted, and and reinstalled DTP, and did the test again. Nothing happens. I’ve tried attaching the script both to groups and documents. Nothing happens. No script will execute when attached to a group or a document.

The information given in the help pdf says that the script is supposed to execute when the item is displayed. But nothing happens when I open the document or group with a script attached into a new window, or change the view.

I must be doing something stupid, or completely misunderstanding how this is supposed to work. Please, what am I doing wrong? Is there some hidden setting that I must enable? DTP 2.3 on 10.6.8. Many thanks.

There is a special syntax for triggered scripts. Look at the Synchronize script in the Extras>Examples folder of the installation package for a good model. Or browse the forum for other triggered scripts that have been posted.

for example

Thank you, korm. I owe you many, many beers.

Nowhere in the DTP documentation or the help is it mentioned that triggered scripts must be defined as “on triggered().”

I did search the forums on various keywords for advice on this issue, and found interesting hints, but not “the secret.” Perhaps the forums should be backed by an AI-enabled DTP database.

For all of DTP’s claimed sophistication, and for all of the ways that seem useful to get information into it, I have been faced at every turn with infuriation and frustration:

▪	Hours of hacking about over trying to run an attached script;
▪	A script can't enumerate databases, or enumerate groups in a database;
▪	And so, a script can't select a database and group at run time, but must rely on the currently selected group in the currently selected database;
▪	The Sorter becomes unresponsive, requiring deletion of its folder (which I learned after an hour of perusing the forums, and after taking the trouble to completely delete and reinstall DTP), and as such, the Sorter is completely unreliable (on Snow Leopard as well as Lion);
▪	The default Global Inbox can't run scripts when items are added;
▪	Having to manually change the Sorter Preference to add items to the Global Inbox or the Inbox of the currently selected database is an unacceptably inflexible way of routing items;
▪	Dragging items into the Global Inbox in a Finder window does not import the items dragged;
▪	A Folder Action attached to the Global Inbox folder does not execute;
▪	There is no way to create a set of targeted folders (whether using Folder Actions or some other method) to drop items into, to route them to specific groups in different databases, by using scrpiting;
▪	The UI is very sensitive to clicks, and I frequently lose the current document's focus, or inadvertently enter edit mode for a record's or group's name;
▪	When I attempt to attach a script, I am delivered to the last folder that I opened in DTP, whether it was to open a database, import a folder, export a folder, etc. making for a frustrating experience (many other apps keep track of these "last locations visited" by their purpose);
▪	The FireFox add-on works only with FF6, which I cannot use because my other addons don't work with FF6;
▪	Smart Folders can't examine dates to determine if they are in the past or future;
▪	The incessant, inescapable Tool Tips are driving me to complete distraction;
▪	Built-in metadata for records is extremely limited;
▪	The search function for the forums is frequently unavailable.

Queries posted to the forums go unanswered by Devon: they seemingly answer only those queries that they wish to answer. I can find no guidance whatsoever in creating scripts to overcome all of these issues–no scripting FAQ, or guide. Evidently, scripting must be accompanied by a generous helping of handwork: manually selecting records, clicking here and there to run scripts, the technique that the example scripts implement.

I bought DTP with high hopes, and so far, I have yet to do anything useful to manage my 3gb of research data, and I haven’t yet even begun to address if importing my research or indexing it is more appropriate, or how to accomplish tagging my 5,500 research items in DTP. I thought that scripting could help, by allowing me to route items to specific groups in DTP with minimal manual steps, but now, I’m not so sure that I won’t have to tag all of these documents manually.

I was (and still am) prepared to spend time and effort getting over the learning curve that one would expect with a new, powerful, and different application, but in the week and a half that I’ve been using DTP, I’ve made very little progress. In fact, the only useful database that I’ve created is one dedicated to tracking issues with DTP.

Yes, this is a rant, but I’m so frustrated that I really don’t know what to do at this point. I will greatly appreciate any guidance on the above issues, and I am grateful for all of your help. And, Devon, please feel free to help me understand how to overcome these issues. I do not exclude the possibility that maybe I’m just dense, and misunderstanding how to do these things. Thank you.