# DEVONthink ## Scripts ### Copy Markdown Link [source](https://discourse.devontechnologies.com/t/markdown-version-of-the-item-link/55041/13) Save to: `~/Library/Application Scripts/com.devon-technologies.think3/Menu/Copy Markdown Link___CTRL-OPT-SHIFT-C.scpt` ```applescript tell application id "DNtp" set theMarkdownLinks to {} repeat with thisRecord in (selected records) copy ("- [" & (name of thisRecord) & "](" & (reference URL of thisRecord) & ")" & return) to end of theMarkdownLinks end repeat if theMarkdownLinks ≠ {} then display notification ((count items of theMarkdownLinks) & " Markdown links copied" as string) with title "Markdown-Link(s) kopiert" set the clipboard to (theMarkdownLinks as string) end if end tell ``` ### Open Record in Obsidian [source](https://axle.design/devonlink-integrate-obsidian-and-devonthink) Save to: `~/Library/Application Scripts/com.devon-technologies.think3/Menu/Open-DEVONthink-record-in-Obsidian___CMD-CTRL-OPT-SHIFT-O.scpt` ```applescript use AppleScript version "2.4" -- Yosemite (10.10) or later use framework "Foundation" use scripting additions on urlEncode(input) -- with thanks to @BlueM on Stack Overflow: https://stackoverflow.com/a/43562220 tell current application's NSString to set rawUrl to stringWithString_(input) set theEncodedURL to rawUrl's stringByAddingPercentEscapesUsingEncoding:4 -- 4 is NSUTF8StringEncoding return theEncodedURL as Unicode text end urlEncode global ObsidianVaultName set ObsidianVaultName to "notes" -- replace this with your exact vault name. tell application id "DNtp" set selectedItems to get the selection set theSelection to the first item in selectedItems set recordFilename to filename of theSelection as string set URLEncodedFilename to my urlEncode(recordFilename) set URLEncodedVaultName to my urlEncode(ObsidianVaultName) set obsidianURL to "obsidian://open?vault=" & URLEncodedVaultName & "&file=" & URLEncodedFilename open location obsidianURL end tell ``` ### Export Records As Instapaper CSV ```applescript tell application id "DNtp" set theCsvRecords to {"URL,Title,Selection,Folder,Timestamp\n"} repeat with thisRecord in (selected records) -- convert an AppleScript Date object to a UNIX timestamp (seconds since epoch) set command to "/bin/date -j -f '%A, %B %e, %Y at %I:%M:%S %p' '" & (creation date of thisRecord) & "'" set command to command & " +%s" set theUnixDate to do shell script command copy ((URL of thisRecord) & "," & "\"" & (name of thisRecord) & "\",,Unread," & theUnixDate & "\n") to end of theCsvRecords end repeat if theCsvRecords ≠ {} then display notification ((count items of theCsvRecords) & " Instapaper CSV records copied" as string) with title "Instapaper Records" set the clipboard to (theCsvRecords as string) end if end tell ```