Question about Trickster Integration Script

@BLUEFROG -

In a recent discussion you mentioned in passing that creating a DT3 Group “is not a filesystem event” and thus does not trigger Trickster.

I am puzzled however. If I set a Group to the Selected Record and manually trigger Trickster’s script, it still does not recognize a group. If I edit the script as per the sections commented out below so that when a file is opened its parent Group is sent to Trickster as well as the file, Trickster still only acknowwedges the file but not the Group.

Why does Trickster not react to a Group record as it does to a document record?


on performSmartRule(theRecords)

tell application id "DNtp"

repeat with theRecord in theRecords

set itemLink to the reference URL of the theRecord

set thePath to the path of the theRecord

set recordPath to the location of theRecord

set appname to name

tell application "Trickster"

add recent thePath source appname displayPath recordPath callbackURL itemLink bundleID "com.devon-technologies.think3"

end tell

(* set itemLink to the reference URL of parent of theRecord

set thePath to the path of parent of theRecord

set recordPath to the location of parent of theRecord

set appname to name

tell application "Trickster"

add recent thePath source appname displayPath recordPath callbackURL itemLink bundleID "com.devon-technologies.think3"

end tell

*)

end repeat

end tell

end performSmartRule

As I previously mentioned, a group in DEVONthink – created or opened – does not exist in the filesystem. While you should not mess about in the internals of a DEVONthink database, you would see the groups you create in DEVONthink do not exist. Your group hierarchies are only components of DEVONthink.

Since there is no corresponding folder created in the filesystem, Trickster has no file path to detect or display.

But Trickster does not work in DT3 by detecting file system events.

Yes, in general file system events from other apps trigger Trickster to add to its own database. But for DT3, the trigger is a a Trickster scripting event triggered by a DT3 smart rule or by any other type of script.

While a DT3 Group is not “real” in the filesystem, a Group record in DT3 is a real as a Document record and a Group x-devonthink URL in DT3 is as real as a Document x-devonthink URL. So I am puzzled why Trickster cannot treat a DT3 group just like it can handle any other record.

Jacob (developer of Trickster) is looking into whether there is a way for Trickster to track non-file system events such as Groups among other events.

That said - I have a question regarding its integration with files. If I create or view an .html file through DT3’s UI, Trickster immediately identifies the action. Oddly however if I create the file with a script (“createRecordWith”) then Trickster does not recognize the file until I later view it.

Why is file creation through the UI recognized by the smart rule but file creation through a script is not recognized?


const NewRecord=a2.createRecordWith ({"name":uprompt+' - '+sumgroup.name(),"type":"HTML"}, {in: sumgroup}  )

const documents=group.children;

NewRecord.source = "<center><font size=5><font color=blue><b>"+uprompt+' - '+sumgroup.name()+"</center></b></font><br><br><font size=3></font color=black>";

Scripts don’t and have never triggered smart rules.

That’s interesting

Then in this case I can just trigger Trickster myself using the same Applescript that the smart rule would have run.

But why not have a script trigger smart rules if the script does the same thing that the UI would have done to trigger the rule?

But why not have a script trigger smart rules

@cgrunenberg would have to comment on the specifics here.

It’s up to the scripter to use the perform smart rule command, only the scripter knows if & when this should happen and which event is the right one.

Let me preface this by saying I acknowledge that DT3 has more capability for scripting than 99% of any software out there - it is amazing in its capability so understand I am just curious hear, not complaining in any way.

I agree it’s also not a big deal to add that to the script so in the end the utility is there.

But that said - if for example I have a smart rule that acts “On Creation” of a document, then why should the app respond any differently if the document is created via the UI or created via script? Why does “only the scripter know” when this should happen? Why not just let it happen based on the same triggers that a Smart Rule uses throughout the UI?

This could easily make the results & behaviour of scripts unpredictable which would be difficult to support and to debug. In addition, it’s unclear when the event should be triggered (a just created record doesn’t have to be final yet). And it’s even unknown what’s the most appropriate event, e.g. the scripts for Mail rules use the import event. Therefore there are no plans to change this, I’m sorry.

OK - not a big deal. Easily added to my script. Thanks.