Evernote as a Backup Source
In this week's post, I want to show how easy it is to create note in EverNote using TextExpander and AppleScript. I do a lot of my development work in BBEdit and this would be a very handy thing to have. Because once in a while, when I make some major code changes, I want to back up the existing file in case my change doesn't work. In the past, I would just copy the file to the desktop, and as a result, I had a lot of files on my desktop.
I thought there must be an easy way to backup files that I am working on. With a some simple AppleScript and TextExpander, I am now able to backup my working document to Evernote.
Make it easy to backup whatever file I am working on in BBEdit into a new note EverNote with the filename as the title of the note.
Create a TextExpander Snippet to copy whatever file I am working on in BBEdit to a new note in EverNote.
TextExpander's AppleScript Snippet
I created a new BBEdit group and set it up so that any snippet that is in the group will only expand in BBEdit. This way if I accidentally type the abbreviation it won't create an empty Evernote Note.
This is the Snippet that I came up with:
tell application "BBEdit" set docname to name of text window 1 set doctext to contents of window 1 end tell tell application "Evernote" create note title docname with text doctext end tell
I selected the following abbreviation: qz
How its Implemented
Now when I am in BBEdit, and I want to create a backup copy of my file, I just type in qz. That's it! A new note will be created in my default Notebook in Evernote. It will have the filename as the title.
Using this method as a backup makes it easy to do back up now, and I get the power of Evernote search and date feature. So I can easily find previous versions of my files whenever I need them.
Technical Note: I know this could have been implemented as an AppleScript menu item within BBEdit, but I wanted to show how you could apply this to other text editor applications other than BBEdit.