DEVONthink script

Try this Link to New script:

tell application id "DNtp"
	set newItem to create record with {name:"$title", type:markdown, plain text:"[$title]($user_link)"}
	set refURL to reference URL of newItem
	set itemPath to path of newItem
end tell
open location refURL
get refURL

$title is replaced with the title of the source document when the script runs
$user_link is replaced with a link to the source document.

so [$title]($user_link) will be transformed into a markdown link to the source document. E.g. [DEVONthink script - Discussion & Help - Hook Productivity Forum](https://discourse.hookproductivity.com/t/devonthink-script/1242)

You can specify the plain text contents of a new record created with AppleScript, so
set newItem to create record with {name:"$title", type:markdown, plain text:"[$title]($user_link)"}
will create a new record with a markdown link to the source document, which, if I understand correctly, is what you’re trying to do.

Hope this helps!

3 Likes