# DEVONthink script

**URL:** https://discourse.hookproductivity.com/t/devonthink-script/1242
**Category:** Discussion & Help
**Created:** [February 13, 2020, 9:50pm UTC](https://discourse.hookproductivity.com/t/devonthink-script/1242 "2020-02-13T21:50:23Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![grahamb](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/grahamb/32/369_2.png) [@grahamb](https://discourse.hookproductivity.com/u/grahamb)
#### Post date: [February 17, 2020, 3:32am UTC](https://discourse.hookproductivity.com/t/devonthink-script/1242/2 "2020-02-17T03:32:35Z")

</div>

Try this Link to New script:

```auto
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!

---

_[View the full topic](https://discourse.hookproductivity.com/t/devonthink-script/1242)._
