I have several scenarios where I have to react on adding a document to a group and on receiving new rss feed items. After reading stuff on the script functionality it seems that the script which I can attach to groups (and rss feeds) only gets started after opening a specific item, not after adding it to the group. Are there other ways to react on (after) adding documents?
I also would like to react on adding a label to a document, but haven’t found something like a callback functionality, where I can register my script to. Does something like that exists? I can workaround with writing my own label script, but that feels less elegant.
on triggered(theRecord)
try
tell application id "com.devon-technologies.thinkpro2"
[do something with theRecord]
end tell
end try
end triggered
The record referenced in the script can be a group or a single document – and is the group or document to which the script is assigned in Tools > Show Info > Script. The trigger event is selecting the group or selecting the document. (I.e., click it in any view.)
Adding a document to a group does not necessarily trigger the script. To ensure the trigger event occurs, select the group after adding the document.
If you want to add a triggered script to a set of documents, write a second script that sets the “attached script” property (the POSIX path to the triggered script in the file system) for each selected document.
Unless triggered scripts are coded with error handling messages, they will fail silently.