Auto-sync: 2026-02-13 13:26:50

This commit is contained in:
Adolfo Reyna
2026-02-13 13:26:50 -05:00
parent 96536f3c86
commit c85db868fd
3 changed files with 77 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
#!/usr/bin/osascript
on run argv
if (count of argv) < 2 then
return "Usage: add_note.scpt <title> <body>"
end if
set noteTitle to item 1 of argv
set noteBody to item 2 of argv
-- Apple Notes expects HTML for the body.
-- We'll wrap the body in minimal HTML.
set htmlBody to "<div>" & noteBody & "</div>"
-- Replace newlines with <br>
set htmlBody to do shell script "echo " & quoted form of htmlBody & " | sed 's/$/<br>/'"
tell application "Notes"
tell default account
-- Check if note exists to append, or create new
set existingNotes to (notes whose name is noteTitle)
if (count of existingNotes) > 0 then
set currentNote to item 1 of existingNotes
set currentBody to body of currentNote
-- Append to existing body
set body of currentNote to currentBody & "<br>" & htmlBody
return "Appended to note: " & noteTitle
else
make new note with properties {name:noteTitle, body:htmlBody}
return "Created new note: " & noteTitle
end if
end tell
end tell
end run