Didn‘t realize that, nice!
Thank you tudoreynon for this kind and rewarding answer
Could you share the script with us? That could be very helpful.
Thank you.
tell application id "DNtp"
activate
----------------------------------------------------------------------------------------- Copy Selected Text to Clipboard
set theOriginalNote to item 1 of (get selection)
tell application "System Events" to keystroke "c" using {command down}
delay 1
set theSelectedText to the clipboard
set theOriginalTitle to name without extension of theOriginalNote
----------------------------------------------------------------------------------------- Save Link to Original Note
if type of theOriginalNote is PDF document then
tell application "System Events" to keystroke "c" using {shift down, control down, option down, command down}
set theOriginalLink to the clipboard
else
set theOriginalLink to reference URL of theOriginalNote
end if
----------------------------------------------------------------------------------------- Set Title for New Note
set theTitle to item 1 of (paragraphs of theSelectedText)
set theTitle to (text returned of (display dialog "Title" default answer theTitle))
----------------------------------------------------------------------------------------- Create New Note, add text and link
set theNewNote to create record with {name:theTitle, type:formatted note}
set source of theNewNote to "<a href=\"" & theOriginalLink & "\">" & theOriginalTitle & "</a>" & "<br><br>" & theSelectedText
set NewLink to reference URL of theNewNote
set the clipboard to NewLink
open window for record theNewNote with force
end tell
Depending on the selected text it might be necessary to replace the characters <>&
to avoid HTML issues.
My AppleScript knowledge is very limited. How exactly should the part you quoted look like?
In the current form, the script creates an HTML file. I would rather have it create RTF. How must the whole script look like if I want to create a RTF file?
set theNewNote to create record with {name:theTitle, type:rtf}
I’m not sure about formatting the source text
How exactly should the part you quoted look like?
Here’s a sample of the original note
I selected the Lorem Ipsum text for movement to the new note
If I have edit access to the original note, I would replace the selected text with a link