Hello everyone -
I’ve been using DevonThink for a little while and I’m trying to branch into more custom automation. I’m a novice with AppleScript so this could be something simple. I’ve got a MarkDown template that I want to create a new record from. The template is pretty basic but it uses the placeholder %recordName%.
I’m creating a record from the template using AppleScript and the import template verb.
tell application id "DNtp"
set templatePath to ("/Users/jefferysmith/Dropbox/DevonThink/Templates/Zettlekasten Note.md")
set thisGroup to incoming group
set thisText to ("Testing Milk")
set theDate to do shell script "date +%Y%m%d%H%M%S"
set itemName to (thisText & " - " & theDate)
set theRecord to import template templatePath to thisGroup
set name of theRecord to itemName
end tell
How would I set the name of theRecord during the import template? It seems like what’s happening is the record is getting created first and then the name is being set. But because the template has already been imported, the placeholder doesn’t seem to trigger. (I’m assuming it’s only on creation?)
Is there an example in the built-in scripts? I looked through them but didn’t see anything with import template. All the scripts appear to be compiled so grep is being foiled.