Jump to content

Recommended Posts

I've browsed through previous discussions on this forum so please read mine carefully before reposting answers from similar questions.

When I look through my HD for notes from Evernote that I want backed up to Time Machine (TM), I find most of my notes but not all. As well, some notes claim that the last date I modified them was Dec 2015 when the most recent time I edited them on Evernote was Jan 2016. (These notes are on the _records folder within the com.Evernote.evernote folder).

I am concerned because if on 'normal' mode (not TM) I cannot locate where Evernote stores all notes to the HD, then how will I be able to locate them on TM? If Evernote is not storing all notes to the HD for some reason, then how can TM back them up?

Might anyone hazard a guess as to why not all my notes are appearing on the HD and how to fix it?

Share this post


Link to post

I'm not sure what you located in your HD search.  

My understanding is that my EN data is stored in an .exb file which is not readable.
Correction; .exb is a Windows thing, Mac is more complicated, files stored in a specific folder. Thanks to JMichaelTX for catching this

There is a standard process where the data is located. On my Mac, I can go to About Evernote, and click on the option key.
The location of the database files is displayed.

My TM app automatically backs up the database files, but I don't think I'll ever use it.
A reload is complicated, and then EN will do a sync and overwrite things.
I have done a reload of EN, and installed on a new machine.  However that was done by EN automatically downloading the data from their cloud servers.

For retrieving notes that have somehow disappeared, I have an HTML export that I update periodically.

Share this post


Link to post
7 hours ago, splittinghairs said:

I am concerned because if on 'normal' mode (not TM) I cannot locate where Evernote stores all notes to the HD, then how will I be able to locate them on TM? If Evernote is not storing all notes to the HD for some reason, then how can TM back them up?

Might anyone hazard a guess as to why not all my notes are appearing on the HD and how to fix it?

Evernote is storing all of your Notes on your local drive.  You may not be able to see some of these due to the folders being hidden.

The Evernote data structure on the Mac is very complicated.  It uses a combination of SQLite databases, folders, and files.  You cannot just restore any one part, or any one Note.  You have to restore the entire Evernote top-level folder, and everything within it.

For more details, see How to Restore Selected Notes from Mac Time Machine (TM) to EN Mac 

 

2 hours ago, DTLow said:

My understanding is that my EN data is stored in an .exb file which is not readable.

This is incorrect.  EN Win uses .EXB file, but EN Mac does NOT.

Share this post


Link to post
On January 6, 2016 at 0:14 PM, JMichaelTX said:

This is incorrect.  EN Win uses .EXB file, but EN Mac does NOT.

Thanks @jmichaeltx That clears up a mystery; for years everyone has been talking about the .exb file but I could never find it on my Mac. I added a correction note to my post.

  • Like 2

Share this post


Link to post

Thanks for the info @JMichaelTX. I hope this means that my invisible files are up-to-date; as I said, the Notes I see are older versions and not all my Notes are on there.

I looked through your link and I confess I'm out of my depth — it's terribly complicated but if the day comes when I need to understand the Evernote data structure I'll be sure to come back with more questions. Again, would you know if the invisible files are being updated and backed up when I perform a TM backup?

I am going to ask a related question on a separate entry but I thought I'd ask it here first. I'm trying to automate Evernote backups to Dropbox as an added precaution beyond using TM. I've read that the Evernote main servers can crash and I do not want to risk losing my Notes. I do manual exports and stick them in Dropbox each month, but I was hoping for a way to automate the process. I came across the following link: http://www.jamierubin.net/2014/08/12/going-paperless-how-and-why-ive-automated-backups-of-my-evernote-data/. This involves changing the volume where I want the export file to reside. I want the exports to reside on Dropbox and I've made the changes on Github, where the script is hosted. But I am unfamiliar with Github and am uncertain of what to do next. Do you, or anyone familiar with Github, know how I might be able to save the changes and run the script on my laptop?

Share this post


Link to post
On January 16, 2016 at 8:23 AM, splittinghairs said:

I'm trying to automate Evernote backups
Do you, or anyone familiar with Github, know how I might be able to save the changes and run the script on my laptop?

Its not really a Github issue,
applescripts are stored on your mac, a file with the extension scpt 
You would download the script to your Mac.

To start - You can put them anywhere handy for easy access
-  (example desktop or Applications folder)

By clicking on the file, the Script Editor is opened and you can edit or execute from there.

Script menu and Automating the execution are another subject.

Share this post


Link to post
13 hours ago, splittinghairs said:

Again, would you know if the invisible files are being updated and backed up when I perform a TM backup?

TM will backup everything, whether it's visible or not, unless the folder/file is specifically excluded in the TM setup.

Share this post


Link to post
11 hours ago, DTLow said:

applescripts are stored on your mac, a file with the extension scpt 
You can put them in your Applications folder for easy access.
By clicking on the file, the Script Editor is opened and you can edit or execute from there.

While you can execute an AppleScript file from any location, the best practice is to put your scripts in the ~/Library/Scripts folder.

This way the script can be run from the Scripts menu in the Apple menu bar, without opening the script in the Script Editor:

Scripts-Menu.png

 

If the script is for a specific app, then put inside of a folder named for the app, like this:

Scripts-Folder.png

Share this post


Link to post
1 hour ago, JMichaelTX said:

While you can execute an AppleScript file from any location, the best practice is to put your scripts in the ~/Library/Scripts folder.

That's true, however I would advise a beginner to stay away from the Library folder. 

Baby steps, 101, Keep It Simple etc.

Share this post


Link to post
14 hours ago, DTLow said:

That's true, however I would advise a beginner to stay away from the Library folder. 

Baby steps, 101, Keep It Simple etc.

I would advise just the opposite.  Starting out with bad behavior only reinforces it.

There is nothing wrong with using the user's home Library folder.  The practice I mentioned is the one recommended by Apple and every experienced, knowledgeable AppleScript developer I know.  I've never seen anyone recommend putting scripts in the Applications folder, except for you.

The benefit of putting scripts in the Script folder should be obvious to all.

Share this post


Link to post
20 minutes ago, JMichaelTX said:

I've never seen anyone recommend putting scripts in the Applications folder, except for you.

Its not that I recommend it, I simply said she can put the scripts in the Applications folder.
I was trying to make it simpler for a beginner.
The scripts can be stored and used from any folder.
And I did acknowledge your point on best practices.

Share this post


Link to post
20 minutes ago, DTLow said:

I simply said she can put the scripts in the Applications folder.
I was trying to make it simpler for a beginner.

Perhaps so, but simpler is not always better.  Encouraging incorrect (or less useful) behavior is counterproductive.
It is not that hard to put scripts in the proper place:  Scripts folder

21 minutes ago, DTLow said:

The scripts can be stored and used from any folder

Yes, but the Script menu will only see scripts stored in the Scripts folder.
So, if you have scripts that you often use, that is clearly the best location.

Share this post


Link to post
8 hours ago, JMichaelTX said:

Yes, but the Script menu will only see scripts stored in the Scripts folder.
So, if you have scripts that you often use, that is clearly the best location.

Agreed; to use the System wide Script Menu, the scripts have to be in a specified folder.

Share this post


Link to post
On 1/17/2016 at 1:58 PM, JMichaelTX said:

While you can execute an AppleScript file from any location, the best practice is to put your scripts in the ~/Library/Scripts folder.

This way the script can be run from the Scripts menu in the Apple menu bar, without opening the script in the Script Editor:

Scripts-Menu.png

 

If the script is for a specific app, then put inside of a folder named for the app, like this:

Scripts-Folder.png

I moved the script to the Evernote folder under Scripts. But when I open ScriptEditor and type in the path to the location where the notes are to be exported, I receive the message "Evernote got an error: The operation couldn’t be completed. Permission denied". I want the notes to be exported to Dropbox, so I set the path: Macintosh HD/Users/MyName/Dropbox/Evernote backups. Any idea why I am receiving this message?

Share this post


Link to post
40 minutes ago, splittinghairs said:

But when I open ScriptEditor and type in the path to the location where the notes are to be exported, I receive the message "Evernote got an error: The operation couldn’t be completed. Permission denied"

Can you post a copy of the script you're using?

Share this post


Link to post

-- 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

 

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

set f to " "

 

with timeout of (30 * 60) seconds

tell application "Evernote"

-- Set date to 1990 so it finds all notes

set matches to find notes "created:19900101"

-- export to file set above

export matches to f

end tell

end timeout

 

-- Compress the file so that there is less to backup to the cloud

set p to POSIX path of f

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

Share this post


Link to post

>>I set the path: Macintosh HD/Users/MyName/Dropbox/Evernote backups.

When I export to a .enex file, I use the path /Users/David/Desktop/Temp-Template.enex

Share this post


Link to post

All right, I added /Users/MyName/Dropbox/Evernote backup.enex and it worked, though it still gave me the same error message. Odd. Thanks for your help, it worked this time, though I had typed in that path before...

I want the .enex file on Dropbox to bear the name of the date I exported it. Is there a way to set this in the script?

Share this post


Link to post
4 minutes ago, DTLow said:

In one of my scripts, I export using 
set tempfile to "/Users/David/Desktop/Temp-Template.enex"

On my script, I changed 'f' to 'tempfile' and ran it. It works, but changing it does not change the name of the .enex file to the current date when exported, unless I'm missing something?

Share this post


Link to post
24 minutes ago, splittinghairs said:

All right, I added /Users/MyName/Dropbox/Evernote backup.enex and it worked, though it still gave me the same error message. Odd. Thanks for your help, it worked this time, though I had typed in that path before...

I want the .enex file on Dropbox to bear the name of the date I exported it. Is there a way to set this in the script?

>>it still gave me the same error message.
Do you get an indication which statement gave the error?

>>I want the .enex file on Dropbox to bear the name of the date I exported it. Is there a way to set this in the script?
For sure.
Right now you are using a hardcoded filename.
You can add code in the form of    set f to f & date & ".enex"

Here's an example of date manipulation I use

set {year:yyyy, month:mmm, day:d, weekday:dddd} to (current date)

    set dd to (text -2 thru -1 of ("0" & d as text))

    set m to mmm as integer

    set mm to (text -2 thru -1 of ("0" & m as text))

    set thetitle to "Journal-" & yyyy & "/" & mm & "/" & dd & " " & dddd as string

Edited by DTLow
added date manipulation sample

Share this post


Link to post

>>Do you get an indication which statement gave the error?

Yes. It tells me when I hit run that there is no such file or directory (where I am exporting to), even though it exports .enex files to the intended Dropbox folder just fine each time I run it, despite denying its existence. 

Would you mind putting that date manipulation in the context of the code I used? I tried it out myself but it's throwing up odd results...

 

Share this post


Link to post
12 minutes ago, splittinghairs said:

Would you mind putting that date manipulation in the context of the code I used? I tried it out myself but it's throwing up odd results...

But then you'd miss out on the joys of playing with AppleScript.  Are we having fun yet?:)

This forum works better if you post your code and we can all comment on it.  There are other users much better at coding than me.

Share this post


Link to post
On February 21, 2016 at 11:37 AM, splittinghairs said:
42 minutes ago, splittinghairs said:

 

42 minutes ago, splittinghairs said:

What line of script should I add to exclude notes in "Trash" from the export?

 

Currently your selection is the line    set matches to find notes "created:19900101"
This is based on the standard Evernote search (for more details see https://dev.evernote.com/doc/articles/search_grammar.php
You can exclude notes by using -, as in -tag:xxxxxx

Are you sure the Trash notebook is included in this selection?  Its been complained that the search excludes the Trash notebook.

Share this post


Link to post

Interesting point. I'm pretty sure it is because more notes are being exported than I have outside of Trash. It seems to me that the only way this could be possible is if Trash were included.

So this would be, what, set matches to exclude -notebook:trash?

Share this post


Link to post
1 hour ago, splittinghairs said:

So this would be, what, set matches to exclude -notebook:trash?

That would have been my guess, except No - see https://discussion.evernote.com/topic/18597-exclude-notebook-from-search/?do=findComment&comment=92632

It only works on other items like tags
The link discusses adding a tag to the notes you want to include/exclude but that doesn't seem like a workable solution.

I haven't been overly concerned about the Trash being included or excluded in my backup process.
Could it be that you're using Trash for active filing - its not the best approach.

Share this post


Link to post
41 minutes ago, splittinghairs said:

Interesting point. I'm pretty sure it is because more notes are being exported than I have outside of Trash. It seems to me that the only way this could be possible is if Trash were included.

You could try importing the .enex file to test this out. The notes go into a new notebook which you can delete after the test.
I would include a note titled "This is a trash note" to identify a trash item.

Share this post


Link to post
7 hours ago, splittinghairs said:

What line of script should I add to exclude notes in "Trash" from the export?

Notes in the EN Trash are automatically excluded from the UI Search and from getting notes via AppleScript.
You can verify this for yourself by running this simple script:

tell application "Evernote"
		
	set nbList to name of every notebook
	set AppleScript's text item delimiters to return
	set nbListStr to nbList as string
		
	log nbListStr
	
end tell -- Evernote 

 

Share this post


Link to post

Turns out I excluded exports from Web Clipper when counting and assumed the surplus was from Trash. I'm happy with the import now. Thanks for that info, guys. 

My script seems good to go, and I've figured out how to automate it in iCal, but I still am running into difficulty with editing the name of the .enex export to reflect the date it was exported. How do you set the name of each export to something particular in the first place?

Share this post


Link to post
1 hour ago, splittinghairs said:

How do you set the name of each export to something particular in the first place?

Here's a sample on setting the date for an exported .enex file

--some date manipulation to create the new title

    

    set {year:yyyy, month:mmm, day:d, weekday:dddd} to (current date)

    set dd to (text -2 thru -1 of ("0" & d as text))

    set m to mmm as integer

    set mm to (text -2 thru -1 of ("0" & m as text))

    set thetitle to "J  ournal-" & yyyy & "/" & mm & "/" & dd & " " & dddd as string

    

    

    -- Retrieve the template, export and import as a new note

    

    set thetemplate to find notes ("intitle:Template-Journal")

    set tempfile to "/Users/David/Desktop/Temp" & yyyy & m & dd & ".enex"

    export thetemplate to tempfile format ENEX

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...