Exporting Images With Usuable Names From Evernote

Evernote is a wonderful tool, but I've periodically grown frustrated with it. Evernote is one of those applications that is powerful and open-ended but, as a result, fails to be the kind of well though-out, opinionated software that makes the Mac so great.

One of my main uses for Evernote over the past few years has been collecting design inspiration — images of websites, apps, products, business cards, graphic and industrial design, and more — that I could refer back to from time to time. I had tags for colors, as this was the primary sorting mechanism I was concerned with, and I set up folders for individual design projects. However, last year I found Pixa, an opinionated piece of software that specifically targets the kind of use case I had been ham-fistedly forcing on Evernote. Yesterday, I made the commitment: it was time to switch.

A recurring knock against Evernote has been its poor exportability. The best option for moving my library would have been to export the Evernote notes as HTML, but any images that were captured using Evernote's web clipper come out with inscrutable names, each of which would have to be changed manually. So, I did what I have been doing lately: I built an Applescript.

The Evernote Image Extractor allows you to select any subset of your Evernote notebooks and a destination folder and will proceed to export every image attached to notes in those notebooks. Images are named using the name of their containing note (with a procedure to ensure that no two images have the same name and overwrite one another), and the images from each notebook are exported as separate folders. While Pixa doesn't have Applescript support, it does have an excellent Live Folder feature that makes it easy to get the exported Evernote images into your Pixa library.

Be patient when running the script the first time — it took about 3 minutes on my Retina MacBook Pro to export 1700 images from my 1000+ notes — but I promise, it will be worth it.


You can see more of my projects on the Projects Page. You can also follow me on Twitter as @pxldots.

Templates.scpt

Once again, I managed to spend a day ignoring my corporate tax and business ethics assignments and make a handy (to me, anyway) OmniFocus script. This one tackles one of the big missing pieces of OmniFocus: templates.

You can download the script here: Templates.scpt. In short, the script looks for a template folder and offers to do all the heavy lifting of creating a new instance of the template. Here's the detailed process, if you're interested:

(1) You make a template folder and some template projects. The variables are designated by a symbol of your choosing (I chose "$" as the default as a tribute to my favorite CSS preprocessor, SASS), with any variables used listed in the last paragraph of the project's note field (i.e., "$Person $Topic $Location"). Variables will be recognized in the project name and in the sub-task names, notes, and contexts. Thanks to Sven Fletcher, it also handles projects without variables gracefully.

0 - Template Folder

(2) Run the script. On the first run, the script will ask what variable you are using and whether you want to be prompted for viewing new template instances after they are made.

1 - Variable Definition

(3) Script goes hunting for templates. The script will try and find a folder that contains "Template" in its name. If it can find one, it will show you all remaining projects in that folder. If it can't, it will ask you to pick a folder that contains your templates, and you can then select from that list.

2 - Select Template

(4) You select destination folder.

3 - Select Folder

(5) You feed script variables. Based on the notes field of the project, the script will prompt you to fill in your desired values for each variable it finds.

4 - Variables

(6) Script works hard. It might take a little while for the whole thing to finish, especially if it is a big template. Be patient! The script replaces any instances of the variables in the project name, task name, task note, and task context. The task context replacement is especially neat: it looks to see if, in replacing the variable in the context, it would create a context you already have. If so, it assigns that context to the task. If not, it creates a new context in the same containing folder as the context with the variable. This process is particularly useful if you use a "Waiting" container to store multiple individual-specific waiting contexts like I do.

In addition, you can specify a relative date (from today) for any number of tasks (or the project as a whole) to start or become due. To do so, simply put "Start" or "Due" at the beginning of a new paragraph, and use the smart date syntax you usually do in OmniFocus (for example, "2d", "4d at 5pm", "3w 2d 14:00", etc). The script will pull that out, assign the calculated date to the start/ due date of that task, and then strip it out of the task notes.

(7) Script finishes. If you told it to prompt you, you will now be asked whether you want to see the new instance, which will open a new OmniFocus window with that project focused on.

5 - View in Context

(8) Admire results.

6 - Completed Templates

Many thanks to the Omni Group for making such an amazing tool (with such excellent Applescript support). Also, I took a lot of inspiration from Curt Clifton's template script, which is amazing.

If you're interested in seeing my past projects, you can check out the Project page. If you want to see what my distracted mind comes up with next, you can follow me on Twitter or subscribe to the RSS feed.

OmniFocus "Mail Complete" AppleScript

Some days, I just feel like blowing off most of the tasks I thought I'd do and work on projects I really enjoy.

That was today.

In addition to the OmniFocus scripts I posted earlier, I built the first version of a pretty neat tool that connects Mail and OmniFocus. If you read my OmniFocus setup post, you'll know that I have many sequential OmniFocus projects with "Waiting For" contexts whenever I need something from someone else to move a project along. I have "Waiting For" contexts for each of the people who I communicate with frequently. The problem is, I often receive emails from these individuals but fail to remember to check off the associated "Waiting For" task. This script solves all that.

The script grabs the senders of all selected tasks and compares this to the list of contexts in your OmniFocus library. For the script to work, the individual waiting contexts must be together in a context group with the string "Wait" somewhere in the name. It then grabs every task that has a "Waiting For" context associated with that sender and has yet to be completed. The tasks it finds will show up in a picker list which allows you to automatically complete one or more. If it doesn't find any tasks, it will look to see if you have a perspective that looks like it's meant to look at "Waiting For" tasks and will offer to open it for you.

Download the script from the Projects page!

An illustration of the picker based on the selected messages.

An illustration of the picker based on the selected messages.

OmniFocus Utility Applescripts

I've been having lots of fun polishing some existing scripts and working on some new OmniFocus Applescripts. Time to do a bit more sharing.

Later.scpt, which allows you to batch-defer selected tasks by a given amount of time/ to a given date and time, has been updated with the ability to specify specific dates and times in a number of new syntaxes, an escape to temporarily change the due/ start date preference, and some general code improvements.

Paraquential.scpt is a very small script that switches the current group/ project between sequential and parallel ordering.

Finally, Name Replace.scpt is a find-and-replace tool for OmniFocus task/ project names. You define the replacement pair using the following syntax: currentString > replacementString. You can also specify how many of the replacements you want to do using "* numberOfReplacements"; for example, appending "* 2" will replace only the first two instances of the replacement pair. You can also do multiple find-and-replace actions simultaneously by separating each with "//". All of these syntax items can be changed in the script file.

All of these are available on the Projects page — I'm learning how to use git and Github so I will (hopefully) soon be able to put these in a more appropriate spot.

AppleScript Experiments: "Later" in OmniFocus and Save As PDF

Update (January 1, 2013): Later.scpt has been updated to allow for absolute date and day of the week date syntaxes. For the most recent version of these and future projects, please take a trip to the Projects page.

On Christmas I received a number of books (which, if the past is any indication, will still be largely unread by next Christmas) on the topic that has really been grabbing my attention these days: programming. From the pile of dead trees I decided to start with Learn AppleScript: The Comprehensive Guide to Scripting and Automation on Mac OS X. Since Christmas day, I have been reading voraciously (though, still not at a swift enough pace to make a significant dent in the 1000-page behemoth), and built two practice scripts that I am pretty excited about. I decided to share these here in the hopes that you, too, might have a use for them1.

Deferring OmniFocus Tasks With OmniFocus-like Syntax: "Later"

Download the script: Later.scpt

I have been a happy user of Dan Byler's OmniFocus AppleScripts (in particular, the "Defer" script that postpones a task's start date by a user-determined number of days) for awhile, but the inability to define the desired start date in OmniFocus's excellent date syntax has always frustrated me. I decided to have a go at replicating the date parser in AppleScript so that I could push a task to a very specific amount of time from today.

The script I built does what I need it to, though your mileage may vary. The script will initially ask if you want to automatically flag tasks while deferring them (which is the basis of my OmniFocus workflow), and will then present a dialog box for you to enter the amount of time to defer the task for. The syntax is the same as OmniFocus's: you can use "weeks", "w", "days", "d", and 24- or 12-hour time specifiers (with or without the AM/a/PM/p). So, for example, writing "2w 4d 12:40pm" would defer the start date of that task for two weeks, and four days, and would set the start time to 12:40pm. You can exclude any of the three pieces and it will still work (as long as you specify at least one item).

A few things: OmniFocus is frustratingly slow at setting the start date of tasks via AppleScript. Every script I looked at, including my own, took about half a second to set the start date for each task no matter what I did. Also, if you have a Retina Mac, be warned: AppleScript does not seem to have access to retina-fied dialog windows, so those look absolutely awful.

Additionally, I have left a lot out that I might add in sometime in the future: the ability to defer due dates instead of (or in addition to) start dates (which I disagree with on a technical level, by the way), the ability to set the date directly instead of relatively, and the use of Growl for notifications.

Saving Word and PowerPoint Files as .pdf

Download the script: Save MS Office as PDF.scpt

The second script was a little simpler and one I wish I didn't need. However, as a student, I receive an enormous amount of .doc/.docx and .ppt/.pptx files. Setting aside the fact that I find Word and PowerPoint to be inferior to Pages and Keynote, respectively (or, in the case of Word, inferior even to a plain text file), viewing these files on iOS devices can result in weird layout problems, and their long-term portability is anything but assured.

The script initially asks whether you use Path Finder or Finder for your file browsing. It then takes the file selection from your preferred application, ignores any non-Word and non-PowerPoint files selected, and starts saving them to the same directory as the original file. It also asks if you want to convert both the Word and PowerPoint files (or only one or the other) if it detects that you have selected both types.

For this script, I will probably work on improving the Path Finder/ Finder selection process, and I may add the option to have the script automatically delete the original Word and PowerPoint files. Other than that, I am fairly happy with this script, though it is still limited by the speed of Word and PowerPoint. It's still miles ahead (both in terms of speed and reliability) of the GUI scripting-based process I had done in Keyboard Maestro.

If you have any comments about the scripts or would like to see something added, feel free to shout at me on Twitter as @pxldots.


1. I find it an incredible part of the world we live in that, with just one good book and the internet at your disposal, even a non-programmer can learn so much, so quickly.  ↩