Quantcast
Channel: DEVONtechnologies Community - Latest posts
Viewing all articles
Browse latest Browse all 17301

Any way to replicate the behaviour of the Note Refactor plugin of Obsidian?

$
0
0

This is scriptable. Here’s a basic example with no error handling at all:


tell application id "DNtp"
	set theText to selected text of think window 1
	set theTitle to my getFirstSentence(theText)
	set selected text of think window 1 to "[[" & theTitle & "]]"
	create record with {name:theTitle, type:markdown, content:theText} in current group
end tell

on getFirstSentence(theString)
	set theDelimiters to (ASCII character 13) & (ASCII character 10) & ".:!?"
	repeat with theChar in theDelimiters
		set theOffset to offset of theChar in theString
		if theOffset is not 0 then set theString to (characters 1 thru theOffset of theString) as string
	end repeat
	return theString
end getFirstSentence


Viewing all articles
Browse latest Browse all 17301

Trending Articles