Does anyone know how to save an attachment from a certain Notes’ note as a separate file.
Edited: also, the attachment part looks like this:
I don’t know how to get copy that file or whatever it is.
Edited: is that a database?
Edited: I think it was Stephan or DJ Bazzie Wazzie who showed how to get the text (utilized in modified scriptl) from html from memory:
tell application "Notes"
set the_note to first note whose name begins with "XML"
set the_body to body of the_note
--name of front window
end tell
set file_spec to quoted form of POSIX path of (choose file name) -- rem - extension
do shell script "echo '" & the_body & "' | textutil -stdin -convert txt -output " & file_spec
but, I never could figure out how to get an attachment.
I ended up getting the whole note with attachment through ui element scripting and pasting into TextEdit. Here’s part of it:
tell application "Notes"
launch
activate
end tell
tell application "System Events"
tell process "Notes"
tell window 1
tell splitter group 1
tell group 1
tell scroll area 1
set value of attribute "AXFocused" to true
(*
tell table 1
every UI element
end tell
*)
end tell
end tell
tell group 2
tell scroll area 1
set value of attribute "AXFocused" to true
--every UI element
end tell
end tell
end tell
end tell
end tell
keystroke "a" using command down
keystroke "c" using command down
end tell
tell application "TextEdit"
launch
activate
make new document at front
end tell
tell application "System Events" to keystroke "v" using command down