Jump to content

backup of evernote


Recommended Posts

Hi.

I want to backup my database via the notebooks and stacks.. not just notes*.. Does anyone know of an applescript or sh script that will export the notes related to the specific notebook. And perhaps even label the export to the notebook.  I have now manually gone to each notebook and exported it.  I would like to automate this.  Thoughts? thanks

Link to post
  • Level 5*

You'd need to export notebook-by-notebook. I've implemented this in Windows PowerShell; you'd need to figure out something equivalent in AppleScript. I'm guessing it's possible, but I'm not a Mac user or Evernote for AppleScript guru.

Link to post

You'd need to export notebook-by-notebook. I've implemented this in Windows PowerShell; you'd need to figure out something equivalent in AppleScript. I'm guessing it's possible, but I'm not a Mac user or Evernote for AppleScript guru.

thanks jefito… for some reason I am having trouble getting the export function to work in apple script… what version are you using? I'm using 5.2.1… I have an applescript but it keeps bailing , error message..""Evernote got an error: The operation couldn’t be completed. Operation not permitted" number 1"  

 

actually from roaming the net, this error is because this EN(5.2.1) is from the app store and not a direct download…. but I want 5.2.1 oh well..will spend more time on this.

 

​Thanks… to all others, I realize I can export notebooks manually..I want to automate this process.. does anyone have a working applescript? thanks

Link to post

I'm not an applescript expert.. I found this on line and can't get it to work... 

perhaps there is a knowledgable applescript person here in the forum that can get it to work. thanks

 

-- PURPOSE: Export all notes in Evernote to an ENEX file so that

-- the notes can be backed up to an external drive or to the cloud

 

set curDate to do shell script "date +’%Y%m%d’"

 

-- Change the path below to the location you want the notes to be exported

set exportPath to "/Users/name/bkup/Evernotxe-" & curDate & "/"

 

do shell script "if [ ! -e " & exportPath & " ]; then mkdir " & exportPath & "; fi;"

 

do shell script "mkdir " & exportPath

 

with timeout of (30 * 60) seconds

tell application "Evernote"

repeat with nb in every notebook of application "Evernote"

set theName to the name of nb

 

set matches to find notes "notebook: " & "\"" & theName & "\""

set f to exportPath & theName & "-" & curDate & ".enex"

export matches to f

if (count of matches) > 0 then

set p to POSIX path of f

 

do shell script "/usr/bin/gzip -f " & quoted form of p

 

end if

end repeat

end tell

 

end timeout

 

Link to post

I have figured out the issues… There is a Bug in EN 6, where applescripts DO NOT work. and then on top of this, EN 5.X must be downloaded from website for applescripts to work (NOT from app store)  So, this is a double whammy… If you want to run the apple script, do NOT use EN6, and find 5.X as a download..dmg file.

Link to post
  • 3 months later...
  • 9 months later...

The export function in the Applescript program linked to above still doesn't seem to be working with the latest Evernote from the app store.  Is this a known bug that just hasn't been fixed yet, or am I doing something wrong?

Link to post
On January 11, 2016 at 2:52 AM, bshannon said:

The export function in the Applescript program linked to above still doesn't seem to be working with the latest Evernote from the app store.  Is this a known bug that just hasn't been fixed yet, or am I doing something wrong?

I'm not sure if any work from the app store.. get it direct from evernote (if it's still possible) I have 2 scripts that work.. NOT from app store... 1) to export enex, other to export HTML incase evernote goes away and the files are more in an industry standard... I did NOT write these.. I pulled them from the interwebs and massaged them! 2 different scripts

 

HTML OUTput

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

 

 

ENEX OUTPUT

set curDate to do shell script "date +'%Y-%m-%d-%H-%M-%S'"

 

with timeout of (30 * 60) seconds

    tell application "Finder"

        set setBackupfolder to "/Users/YOURFOLDERHERE/" as POSIX file -- set backup folder path

        

        -- confirm valid path exists

        if setBackupfolder exists then

        else

            display dialog "The backup path you set does not exist. Please go to line 3, set a valid path and re-run this script." giving up after 99999999

            error number -128

        end if

        set backupFolder to setBackupfolder as text

    end tell

    

    -- activate evernote

    tell application "Evernote"

        activate

        

        -- wait for evernote to come to the front

        tell application "Finder"

            set frontAppname to "whatever"

            repeat while frontAppname is not "Evernote"

                tell application "System Events" to set frontAppname to name of first process where frontmost is true

            end repeat

            delay 1 -- wait a little more

        end tell

        

        -- do the backup

        set allNotebooks to every notebook

        repeat with currentNotebook in allNotebooks

            set notebookName to (the name of currentNotebook)

            set allNotes to every note in notebook notebookName

            if every note in notebook notebookName exists then -- proceed if notebook is not empty

                set dateString to (current date) as text -- get the date

                set newDatestring to {}

                repeat with i in dateString -- change colon in time stamp (changed to slash in Finder) to underscore

                    if (i as string) is ":" then

                        set end of newDatestring to "_"

                    else

                        set end of newDatestring to (i as string)

                    end if

                end repeat

                set exportFilename to (backupFolder & notebookName & " - Backed up on " & newDatestring & ".enex")

                export allNotes to exportFilename

            end if

        end repeat

        

        -- confirmation dialog

        display dialog "The backup of your Evernote notebooks is complete." buttons {"View Backup Folder", "OK"} default button 2 giving up after 99999999

        if the button returned of the result is "View Backup Folder" then

            tell application "Finder"

                activate

                open backupFolder

            end tell

        end if

        

    end tell

end timeout

 

 

Link to post

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...