How to export notes from Evernote using AppleScript?

I am trying to export notes from Evernote v.3.3.0 in HTML format to disk space using AppleScript. The task at hand does not seem particularly difficult, but my relatively new for Evernote and completely new for AppleScript does not help much ...;)

Here is what I came up with so far - any comments are greatly appreciated!

tell application "Evernote" set allmynotes to find notes set outputpath to "/Users/{myusername}/Desktop/Test" export allmynotes to outputpath format HTML end tell 

From what I understand, exporting in HTML format creates one file per note, so I suggested that I need to specify the name of the output folder instead of the name of the output file. Another assumption is that a double-click script will run with the credentials of the active user; on my machine this user has sufficient permissions to write to the specified folder.

The results so far are Evernote got an error: Unable to remove existing output file." number 1 and Evernote got an error: Unable to create output directory. .. Any ideas?

Thank you very much in advance!:)

+4
source share
5 answers

Victory at last! The problem had nothing to do with my script and all with the fact that I installed Evernote from the App Store. The version of the App Store, unlike the version that can be downloaded from evernote.com, is limited to the Sandboxing application on Mac OS X. Now, if the version not supported by the App Store works fine.

Thanks again for the answer, and for those experiencing the same problems - I hope your problems are also solved above.

+6
source

Think this is a bug in 3.3. I have written a fair amount of AppleScripts for Evernote (including those that work with working export functions), and have recently encountered the same types of "resolution" errors .

When I turned to Evernote developer support, they replied that their team was currently considering this issue. I will forward this page to them by their link and, hopefully, version 3.3.1 will bring a fix!

+1
source

You were close:

 set outputpath to (path to desktop as text) & "Evernote Test" do shell script "mkdir -p " & quoted form of POSIX path of outputpath tell application "Evernote" set allmynotes to find notes export allmynotes to outputpath format HTML end tell 
0
source

In Evernote 5.2.1 (Mac OS X 10.8.4) I can check the adayzdone answer for reliable operation, regardless of whether an existing output folder exists. If this folder exists, Evernote will move it to the trash and create a new one.

From the original question, I collect uncertainty about how to handle extreme cases (for example, an already existing export folder). Here is the code to handle such a case with a dialog.

 set folderName to "Latest Evernote HTML Export" set exportFolder to (path to documents folder as text) & folderName as text tell application "Finder" if exportFolder exists then set answer to the button returned of (display dialog "This will overwrite the previous Evernote HTML export" buttons {"Stop", "Overwrite"} default button 1) if answer is equal to "Stop" then error number -128 -- end script with error "User Cancelled" end if end if end tell tell application "Evernote" set allNotes to find notes export allNotes to exportFolder format HTML end tell 

Hint for testing. To avoid exporting the full Evernote library (which can be very large), you can replace the two occurrences of allNotes with {firstNote, secondNote}.

0
source
 set folderName to "Latest Evernote HTML Export" set exportFolder to (path to documents folder as text) & folderName as text tell application "Finder" if exportFolder exists then set answer to the button returned of (display dialog "This will overwrite the previous Evernote HTML export" buttons {"Stop", "Overwrite"} default button 1) if answer is equal to "Stop" then error number -128 -- end script with error "User Cancelled" end if end if end tell tell application "Evernote" set allNotes to find notes export allNotes to exportFolder format HTML end tell 
0
source

All Articles