'temporary' template with external link

Hi,
I basically use DT to write down notes and quotes for my research and I have created a minimal template that look like this:

WRITE QUOTE HERE
[WRITE CITATION LINK HERE]

WRITE COMMENT HERE

WRITE KEYWORDS HERE

What I’d like to do is to have a ‘temporary’ template that, after copying the citation link from my ref manager could automatically generate a new file that look like this:

WRITE QUOTE HERE
[bookends://sonnysoftware.com/74050]

WRITE COMMENT HERE

WRITE KEYWORDS HERE

Can somebody help me?

This is only possible by using AppleScript, a simple script for plain texts could look like this:


property pTemplate : "WRITE QUOTE HERE" & return & "%clipboard%" & return & return & "WRITE COMMENT HERE" & return & return & "WRITE KEYWORDS HERE"

tell application id "com.devon-technologies.thinkpro2"
	set theString to pTemplate
	set theClipboard to the clipboard as string
	set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "%clipboard%"}
	set theStringParts to text items of theString
	set theString to text item 1 of theStringParts as string
	repeat with eachPart in items 2 thru -1 of theStringParts
		set theString to theString & theClipboard & eachPart as string
	end repeat
	set AppleScript's text item delimiters to od
	create record with {name:(paragraph 1 of theClipboard), type:txt, plain text:theString} in current group
end tell