Copy page link to markdown

Does anyone know of a way to copy a page link with the title of the document? I would like to paste the page link from a PDF file into a markdown file like this [Title of document](devonthink page URL). I found a script to copy item link this way, but I would love if this worked with copy page link as well.


I modified some helpful code by Korm to solve my problem. The script copies the selected content to the clipboard as well. Here is the script if anyone needs it…

-- Copy selected text in PDF and append markdown style page link
-- Original script:
-- 20140818 -- made by korm -- adjust as your wish, but please attribute copies
-- see

tell application id "DNtp"
	set thisItem to content record
	set theText to selected text of think window 1
	if theText is {} then
		error "Select some text"
	end if
	if the current page of think window 1 ≠ -1 then
		set thePage to "?page=" & ((the current page of think window 1) as string)
	end if
	set theUrl to reference URL of thisItem & thePage
	set the clipboard to theText & " " & "[" & name of thisItem & "](" & theUrl & ")"
end tell