I am not sure I understand how you are linking your notes. Still, I will share something that could perhaps be useful.
This is an adaptation of the script Christian wrote after I posted a Keyboard Maestro macro to create a new MD note with the selected text as name via ⌘L shortcut.
As you can imagine I ditched the macro and sticked with to an adapted version of the script.
The main differences are:
- if there is no text selected, instead of throwing an error, it will ask you for the nome name.
- when it asks for the note text, it will already have the clipboard content set as the default answer.
- it will insert the name of the note whence it was created as a keyword in the body of the note. To me this is the same as inserting a backlink, since I use auto linking mode. If you don’t, it should be easy to adapt to insert the proper MD link using the note’s UUID.
- it will open the new MD file in a new tab on the same window.
tell application id "DNtp"
try
if not (exists think window 1) then error "No window opened."
-- Adquirir variáveis primárias
set currentRecord to (content record of think window 1) -- Record ativo
set theOrigin to name of currentRecord -- Nome do record ativo para backlink
set theGroup to parent 1 of currentRecord -- Grupo do record ativo para local da nova nota
-- Usar texto selecionado como nome
try
set invalidName to false
set theName to selected text of think window 1
if theName is "" then set invalidName to true
on error
set invalidName to true
end try
if invalidName then set theName to display name editor info "Insert note name" -- Em caso de erro, solicitar nome
-- Solicitar texto da nota. Padrão é clipboard.
set theContent to display name editor info "Insert note text" default answer the clipboard
-- Inserir return link
set theBLC to {"true", "false"}
set theBL to choose from list theBLC with prompt "Insert backlink?" default items {"true"}
set theBLR to item 1 of theBL -- Resultado da escolha
-- Texto da nota com return link
if theBLR is "true" then
set theMD to "# " & theName & return & return & "Keywords: " & theOrigin & return & return & theContent & return -- Reunir todo conteúdo da nota
-- Texto da nota sem return link
else if theBLR is "false" then
set theMD to "# " & theName & return & return & "Keywords: " & return & return & theContent & return -- Reunir todo conteúdo da nota
end if
-- Criar novo record
set theResult to create record with {name:theName, type:markdown, content:theMD} in theGroup
-- Abrir novo record em uma aba na mesma janela
open tab for record theResult in think window 1
-- Msg de erro
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
end try
end tell
I severely dislike using random uuids to identify my notes. But I guess this script could work with this as well, but I am not sure.