You need to remember to be specific in your inquiries, especially regarding automation. The details matter. It’s apparent now you’re processing just Markdown documents into other documents, but you haven’t made that clear. If you change the first handler in @cgrunenberg’s script to this, it should work. However, you still need to keep the second handler intact…
tell application id "DNtp"
if not (exists (content record)) then return
if (type of (content record)) is markdown then
set theText to selected text of think window 1
set theTitle to my getFirstSentence(theText)
set newRecord to (create record with {name:theTitle, type:markdown, content:theText} in current group)
set selected text of think window 1 to "[" & theTitle & "…](" & reference URL of newRecord & ") "
end if
end tell
This modifies the current Markdown document like this…
