As is well documented on this site I:
- Hate storing my files in folder (mostly because I suck at it);
- Overcome this hatred by using a naming convention that makes it easy to recall my files.
All of my text files are stored in nvALT and most other files are stored in Evernote (larger files live in Dropbox).
Now all of this is well and good, except for one small thing… I wasn’t doing the upfront work on filing. Over time, I’d either:
- Toss files into a single folder on the desktop;
- Leave them in my downloads folder.
And active files, well, they would just live on the desktop. For the most part this was an effective system, as it kept most things “out of site, out of mind,” but I’d run into plenty of situations where I had to go looking for something that should have been filed away in Evernote, but wasn’t.
Geek Phase I – Automatically Filing Using Hazel and Evernote
So, as most geeks do, I made a few changes that improved my workflow by:
- Changing the download folder in Safari and Mailplane to the desktop;
- Using Kaity Floyd’s nifty Hazel/AppleScript trick to automatically file things away in Evernote;
- Tweaking the Hazel rule to automatically file anything that uses my beloved naming convention (that was lovingly stolen from Merlin Mann).
Now, when a file on my desktop is properly named (i.e. Workx – File Name – 13–01–24), Hazel sees that little “x – ” bit and works its magic. Since making this change, I haven’t tossed a single file into a random folder and no longer store anything in a downloads folder that I never think to check. Everything is where it’s meant to be: still on my desktop, properly stored in Evernote or, best of all, in the trash.
Geek Phase II – Adding These Files to OmniFocus
Much as this change was an improvement, I couldn’t help but notice that the increasing number of files that were building up on the desktop. Traditionally, only files I was actively working on would live there, but since there was no folder in which to throw things, files for future actions/projects started piling up.
As I’ve shared in the past, I’m a bit nuts about keeping my digital desktop neat (this probably has a lot to do with my struggles to keep a physical one tidy). So the answer was obvious, but clunky: throw the files into Evernote, then create a task in OmniFocus with a link to the note. This worked, but required a multi-step process that involved naming the file, opening Evernote, selecting the right note and then using a Keyboard Maestro macro to pull the note into a new task in the OmniFocus clipper. Not bad, but not ideal.
So I did what most geeks who don’t know how to code do: I whined about this to smarter nerds. In this case Brett Kelly, Nick Wynja and Justin Lancy were kind enough to help me figure out how to use AppleScript to get the link to a newly created Evernote note. Once I combined this with some AppleScript that Ken Case provided in a previous post and tweaked my Hazel rule, magic started happening. Any file that has “- of ” (i.e. Workx – File Name – of – 13–01–24) in addition to my naming convention is sent to Evernote and a task is created in the OmniFocus Clipper with a link back to the note. My desktop is clean once more and my files are easily accessible, either for reference or use in a task.
Geek Phase III – The Little Details
I’m not quite done with this. My skills are very limited (and Justin is having fun watching me struggle to finish the job), but I’d like to get it so the additional “- of ” is removed from the file name before it gets saved into Evernote and added to my task. That said, I figure this is at a stage where you might benefit from it as well (even though you’ll probably need to make some changes to suit your own needs).
While I’m sure this will be updated periodically, here’s the code (or you can just download it here):
--RESET VALUES
set myNote to {}
set noteLink to missing value
set AppleScript's text item delimiters to {" - "}
tell application "Evernote"
--TEST TO SEE IF EVERNOTE IS CURRENTLY SYNCHRONIZING...
repeat until isSynchronizing is false
--THIS EMPTY LOOP WILL PAUSE SCRIPT UNTIL PREVIOUS SYNC IS FINISHED
end repeat
--CREATE THE NOTE
set myNote to create note from file theFile
--SET THE NAME
set myName to (filename of attachment 1 of myNote)
--SYNCHRONIZE WITH EVERNOTE'S SERVERS
synchronize
--PAUSE UNTIL THERE IS A VALUE FOR NOTE LINK
repeat while noteLink is missing value
--GET THE NOTE LINK FOR THE CURRENT NOTE
set noteLink to (note link of myNote)
end repeat
end tell
-- These are the parameters you might want to tweak
set TaskName to second text item of myName
set TaskNote to noteLink
-- Here is the script code itself
tell application "OmniFocus"
tell quick entry
-- open the quick entry window
open
-- Create a new inbox item
set NewInboxItem to (make new inbox task with properties {name:TaskName, note:TaskNote})
-- Expand the note so it's visible in the Quick Entry window
set note expanded of last leaf to true
-- Start editing the task name
select last leaf -- Select the new item
activate -- Make the app active so it gets our scripted keystrokes
delay 0.25 -- Give it a chance to activate
tell application "System Events"
if UI elements enabled is true then
tell process "OmniFocus"
keystroke "e" -- Starts editing the current row
keystroke "a" using command down -- Command-A selects the text
end tell
end if
end tell
end tell
end tell
Geek Phase IV – The Big Workflow
Crazy and excessive as this all may sound, this is actually one of those “life hacks” that will save me time and headache on a daily basis. It’s also a great reminder that it’s not about one application, but one workflow. The process involves triggering a snippet in TextExpander, which triggers a rule in Hazel, which creates a note with my file in Evernote, which adds a task with a link to my note in OmniFocus, but to me it’s all one fairly seamless step (there is a bit of lag, as the note synchronizes). It’s amazing what the right apps can accomplish (especially when you know the right nerds).
Thanks to Ken and Katie for the head start as well as Brett, Nick and Justin for putting up with me on this.

Pingback: Sandpaper Apps