In DEVONthink 3.8, I have a Smart Rule to run an AppleScript script that uses a document’s file path to run an external command. It’s set to execute “On Creation”, “On Import”, and “On Duplicating”. It works fine when I create a document via, e.g., Data ▹ New ▹ Markdown text, but not when I create a markdown document using the “Take Note Hotkey”, and I discovered why: the record in the AppleScript executed by the Smart Rule does not have a file name at the time the Smart Rule runs. Specifically, in the code
repeat with _record in selectedRecords set file_path to the path of the first item of _record
the value of
file_path is an empty string. Presumably, it’s because the document has been created but has not yet been saved. I attempted to change the condition to “After Saving”, but that didn’t seem to have an effect.
So … how can I write a smart rule that invokes an external command on the file created by using the “Take Note Hotkey” pop-up window?