I saw a post the other day about using Hazel + Calibre to automatically import your Kindle files into Calibre. While the user did this to automatically strip the DRM from the books, the tutorial is smart for any one who wants to create an ongoing catalog of their purchases. It was the first time I had heard about Hazel, a low priced software that serves as a macro utility. A macro utility essentially records a number of repetitive steps to complete a task. In the future, rather than executing each step individually, you simply run the macro.
But MAC Operating Systems have a macro utility built right in. It’s called “Automator“. I’ve just started researching Automator and I’m blown away at what it can be set up to do for you. These types of programs really are harnessing the power of your computer and making the device work for you.
I’ve set up Automator to “watch” the folders where I download my ebooks – either in epub, pdf, or Kindle – and move them into a separate folder. From there, every time a book is added to that folder, Calibre knows to add it into my Calibre library, will delete the book (to avoid duplicates) and if it is DRM free, Calibre will convert it into my preferred format. The only thing I do to set this Rube Goldberg-esque sequence into motion is to download a new book using either Adobe Digital Editions or Kindle for Mac. The rest of it happens automatically. Onto the Tutorial.
To do this, open your Kindle for Mac program. Go to Kindle on the menu bar and selectPreferences. In the second section there is an option to change the content folder.
Step 1. Create a Folder Action
Open Automator and if you don’t get the above screen, type command + N for “New”. Selection “Folder Action”. This is because you want the “workflow” (or series of commands) to run when a new file or folder is created in your ADE/Reader/Kindle ebook folders.
Step 2. Choose the Folder to attach your action.
This is where you will browse for the folder where your ADE books or Kindle books are downloaded. Generally, unless you have changed this, it should be in your “Documents” folder. ADE stores the books in a folder called My Digital Editions. Sony in a folder called “My Books/Reader”. Kindle books may be stored in My Kindle folder but you may also find them in /Users/yourcomputername/Library/Application Support/Kindle/My Kindle Content.
Step 3. Start your workflow by selecting from the Files/Folders Actions.
We are only going to be using the Files/Folders Actions. On the left side there are two choices: Actions and Variables. Click on Actions and then drill down to Files/Folders. This way you will only see the actions related to Files/Folders in the column to the right.
Step 4. Select “Get Specified Finder Items” and then drag it onto the workflow space to the left.
Press “Add” and then browse to the folder where your ebooks are downloaded. (Step 2 folder). This command tells the computer to get all the items in the finder folder.
Step 5. Select “Filter finder items.”
We don’t want to select everything in the folder, only files that are actually ebooks. In the Reader or Adobe Digital Editions folder, you want to copy files that end with epub or pdf. If you are doing Kindle, you would want to move only those files that contain azw. It’s important that your middle column is “contains” or “begins with” and not “is”. “Is” requires an exact match. Sometimes AZW files are azw3 or azw4. A command that says “file extension is azw” would ignore files that have azw3 or azw4.
Step 6. “Get Folder Contents”
I did not include this step my first time I created the script and it didn’t work right. I guess this command tells the computer to gather up your “filtered” files.
Step 7. Copy Finder Items.
This last step copies the filtered file items to another folder. I’ve created another folder (“autoadbooks”) that I have set Calibre to watch. Now save the automator script and close the program. You are done with Automator.
Step 8. Set Calibre to Auto Add books
Under preferences – > Add, Calibre has an option to autoadd books to the program. Once Calibre auto adds a book, it will delete the book file. This is why you use the copy feature in Step 7 instead of the move feature.
Note that you only check the boxes under “ignore files with the following extensions when automatically adding” when you want to exclude the files. I stupidly checked epub/pdf/azw without paying attention to the instructions and wondered for hours why Calibre’s autoadd didn’t work. Thankfully I figured it out before I posted a panicked message at MobileReads.
Restart Calibre and start enjoying your automatic goodness.
Other interesting uses of Hazel and books
- This guy uses Hazel + Dropbox + Calibre to convert epubs to mobis automatically.
- This guy writes about using Hazel + Automator to get articles from Instapaper to his Kindle.