taskbridgeapp.notes.model.notescript.create_note_script
- taskbridgeapp.notes.model.notescript.create_note_script = 'on run argv\nset {note_folder, note_name, export_file} to {item 1, item 2, item 3} of argv\nset note_folder to note_folder\n\ntell application "Finder"\n set input_file to my POSIX file export_file\n set input_lines to read input_file as «class utf8» using delimiter linefeed\nend tell\n\ntell application "Notes"\n tell folder note_folder\n set theNote to make new note\n tell theNote\n set note_body to "<h1>" & note_name & "</h1>"\n repeat with note_line in input_lines\n if note_line contains "<img" then\n -- Image Attachment\n set sed_extract to "echo \'" & note_line & "\' | sed -n \'s/.*src=\\"\\\\([^\\"]*\\\\)\\".*/\\\\1/p\'"\n set image_url to do shell script sed_extract\n set theFile to (image_url) as POSIX file\n make new attachment at end of attachments with data theFile\n set note_body to note_body & "<div><img style=\\"max-width: 100%; max-height: 100%;\\" src=\\"" & image_url & "\\"/>\n <div><br></div>"\n else\n -- Normal Line\n set note_body to note_body & note_line\n end if\n end repeat\n set body to note_body\n end tell\n end tell\nend tell\nreturn modification date of theNote\nend run'
Create a new local note.