Saturday, December 3, 2022

#1 2014-08-31 12:18:35 pm

kel1
Member
Registered: 2013-01-11
Posts: 2188

Save Notes attachment

Hi,

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:

<div><object type=\"application/x-apple-msg-attachment\" data=\"cid:1B08E3E5-101F-41E1-95B7-A7F56A96D508@hawaii.rr.com\"></object></div><div><br></div><div>Nene</div><div><br></div></body></html>


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:

Applescript:

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.

Thanks,
kel

Last edited by kel1 (2014-08-31 02:25:28 pm)


Os 10.10.3
Mbp

Offline

 

#2 2014-09-02 09:49:03 pm

kel1
Member
Registered: 2013-01-11
Posts: 2188

Re: Save Notes attachment

I ended up getting the whole note with attachment through ui element scripting and pasting into TextEdit. Here's part of it:

Applescript:

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

Thanks anyway,
kel


Os 10.10.3
Mbp

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)