This Week's Sponsor:

TRMNL

The E-ink Companion For Your Favorite Tools


Posts tagged with "automation"

From Instapaper and Pythonista To Dropbox and Evernote As PDF

I’ve already expressed my preference for archiving webpages as PDFs rather than simple “bookmarks” on an online service. When I come across a webpage that I know I want to keep for future reference, I like to generate a clean-looking PDF file with selectable text that I can rely on for years to come.

Lately, I have become obsessed with turning longer articles I find on the Internet also into PDFs for long-term archival. For as much as I like Instapaper, I can’t be sure that the service will be around in the next decades, and I don’t want my archive of longform and quality content to be lost in the cloud. So I have come up with a way to combine Instapaper with the benefit of PDFs, Dropbox, and automation to generate documents off any link or webpage, from any device, within seconds.

Yesterday I put together an iOS and OS X workflow to generate PDFs remotely on my Mac, starting from a simple bookmarklet on iOS. On an iPhone or iPad, I can simply hit a button in Safari, and wait for Pythonista to turn a webpage (that’s already been passed through Instapaper’s text bookmarklet) into an .html file in my Dropbox, which is then converted to PDF and added to Evernote. It sounds complex, but in actual practice I can go from a Safari webpage on iOS to a PDF in the Evernote app in around 30 seconds. Hopefully you’ll find this quick solution useful; feel free to modify it and/or send suggestions. Read more


Home Automation With An iPad

Home Automation With An iPad

Here’s another interesting use case for my ongoing coverage of Pythonista. From the Pythonista Community Forums, user nlecaude shares a script and a demo video showing how he managed to control the lights in his house using Pythonista (thanks, Gabe).

The Pythonista app is pretty simple, it’s basically crossfading between different images to show the current state of the lights. I have one layer for each state (3 lights so 2^3) and I have invisible layers that I use as buttons to trigger the lamps and transition on and off. I’m quite fascinated by the possibilities of Pythonista.

If you watch the video below, it basically looks like magic. This guy is tapping on a photo of his room on an iPad to turn the actual lights on and off. In practice, he’s using a Python library to control a Philips Hue system that reacts to touch input from Pythonista.

For those unaware of Philips’ product, Hue is a personal wireless lightning system that can be remotely controlled and programmed to offer different lightning settings and color combinations for every occasion. Philips isn’t offering an SDK for developers yet, but the Python library manages to directly connect to the Hue wireless bridge and send input commands.

As nlecaude writes, this is just a script put together in 10 minutes with an unofficial library. The possibilities for home automation programmed from an iPad are seriously intriguing.

Permalink

Andreas Zeitler’s Keyboard Maestro Macros Repo

Andreas Zeitler’s Keyboard Maestro Macros Repo

A new collection of Keyboard Maestro macros by Andreas Zeitler:

Macros are meant to be imported “folder by folder”, rather than all at once. I’ve tried to make it more convenient for the user by putting all macros in a group labelled “Keyboard Maestro Macros Repo” before exporting. This way they are imported in a group of the same name, so that you can easier find them.

Note however: Some macros have very “commonly” used triggers like F1, ↑, or ↓. In these instances it is best to put the macros in a new group that is only available in one certain application, or a group that can be turned on and off by a separate shortcut. The window manipulation macros are an example of that. The triggers for moving a window by 1px in either direction is simply ↑, ↓, ←, and →. If not put in a new group you won’t be able to use these keys anymore.

Andreas is the creator of the Keyboard Maestro Markdown Library, which I use on a daily basis. In fact, I don’t think I could ever come back to using a Mac – or writing on my computer in general – without the Keyboard Maestro Markdown Library, which is now part of the repo available on GitHub.

I’m already a big fan of several macros Andreas included in this new collection. I particularly appreciate the ones related to Mail: there’s one to easily copy a message’s unique URL, and another one to print a message as PDF with a single keystroke.

Get them here.

Permalink

Quickly Email A Picture On iOS Using Pythonista

Quickly Email A Picture On iOS Using Pythonista

In my review of Pythonista yesterday, I didn’t include any scripts to send email messages. Email is, however, a huge part of my iOS workflow, as I often send screenshots back and forth with my teammates about upcoming site features or new apps I’m testing. Fortunately, Pythonista developer Ole Zorn shared today a script that uses smtplib to quickly send an image via email. His script is available on GitHub Gists here.

I have modified it slightly to import my login data using keychain and send an image that’s been previously copied to the clipboard. In this way, I can take a screenshot/photo, open the Photos app, copy it, and send it via email in seconds, at full-size. You can save the script as shortcut on your Home screen and have one-tap access to it, or, even better, you can copy images from Safari without saving them first to the Camera Roll (though, in my tests, this hasn’t always worked reliably). My modification also uses console.input_alert to let you enter a different email address and Subject every time, and it plays a sound effect when an email is sent. Right now, the ImageMail script works with Gmail, but it could be easily modified to work for other email services.

In a future version of Pythonista, I think it’d be neat to have a dedicated Address Book module to return contact fields such as email addresses or Twitter usernames; Ole suggests Reminders and Calendar integration might be handy as well. I think Pythonista has a very bright future, so we’ll see. In the meantime, you can download my modified version of the ImageMail script here.

Pythonista is available at $4.99 on the App Store.

Permalink

Poking A Hole In The Sandbox: Using URLs on iOS

Poking A Hole In The Sandbox: Using URLs on iOS

Using URLs on iOS

Using URLs on iOS

Just yesterday I wrote extensively about URL schemes and, specifically, x-callback-url in my review of Pythonista:

I believe that, going forward, Pythonista and other similar apps will show a new kind of “scripting” and task automation built around the core strenghts of iOS. As we’ve seen, x-callback-url is a standard that leverages a part of iOS – URL schemes – to achieve simple, user-friendly and URL-based inter-app communication that can be used in a variety of ways. Looking ahead, there’s a chance rumored features such as XPC will bring more Mac-like functionalities to iOS, but developers will still find new ways to make iOS more powerful without giving up on positive aspects such as increased security and the simplicity of the app model.

My workflow focused on x-callback-url, a protocol created by Agile Tortoise’s Greg Pierce. Thanks to 360|iDev, you can now watch a free session video of Greg Pierce himself explaining the basics of URL schemes on iOS as well as techniques to properly implement his specification, x-callback-url, to allow for more advanced inter-app communication, such as the one I’m using with Pythonista.

If you’re a developer and you’re interested in knowing more on the subject, check out the free video here.

Permalink


Automatic Screenshot Uploading with Dropbox and Automator

Automatic Screenshot Uploading with Dropbox and Automator

Matteo Agosti figured out a simple yet effective way to upload items to your Dropbox Public folder and automatically receive their URLs in the clipboard: Automator.

After long time using various utilities to automatically share my screen shots when I updated to Montain Lion I had to find another solution as many of them stopped working. It came to my mind that OS X is bundled with Automator, an extremely powerful utility that I always relegated to thumbnails generation. So I decided to give it a try and I eventually made it. That’s how I did.

His folder action is extremely simple: it monitors a folder, filters items that begin with “Screen Shot” and that are images, then moves them to your Dropbox Public folder. By using your unique Dropbox ID, it places a link in the clipboard guessing what the final URL will look like; the URL is made of the standard initial “dropbox.com/u/” portion combined with a URL-encoded version of the file’s name.

The obvious downside is that this workflow isn’t directly communicating (i.e. uploading) with Dropbox: it’s simply moving files and composing the link that you will get once the upload is finished. In my tests, for instance, the URL received by the workflow became available after 10-20 seconds – when the Dropbox app actually finished uploading the file. After that, the URL was indeed correct.

Still, if you’re looking for a simple way to upload public Dropbox files and get a link back, you should check out Matteo’s post.

Permalink

Automatically Convert .iconset to .icns with Drag & Drop

Automatically Convert .iconset to .icns with Drag & Drop

Earlier today I indirectly asked on App.net and Twitter if there was a way to automate the process of converting sets of icons for non-Retina and Retina devices. On its developer documentation, Apple recommends using iconutil and tiffutil to convert application icons and graphic resources, respectively. Once you’ve packaged, for instance, .png files inside an .iconset folder, you should fire up the Terminal, and run the command for the .iconset folder you want to convert. How about automating the process for batch conversion of multiple files?

As it often turns out, if you can think about it, then someone likely already blogged about it. Jono Hunt wrote a drag & drop utility earlier this year to do just that: select multiple .iconset folders, drop them onto the app, receive converted .icns files.

Apple have changed the way you should compile .icns files used for Mac application icons. Instead of using Icon Composer you should now use the “iconutil” Terminal command with .png images contained in folders with the .iconset extension. I created an AppleScript droplet to simplify the process. Just drag the .iconset folder containing your .png files on to the app to easily create a retina ready .icns icon.

Jono has also released versions of the script that work with Alfred and Automator. He also build a counterpart for tiffutil, available for download here.

Permalink

Automatically Save An OmniFocus Project As iThoughts Mind Map

Automatically Save An OmniFocus Project As iThoughts Mind Map

After I posted about my OmniFocus > iThoughts mind-mapping workflow, several readers asked whether it’d be possible to only convert a specific section of OmniFocus to iThoughts format (as well as plain text and OPML). As Robin Trew, creator of the script, explains in the Help section:

Specify a sub-tree by the OmniFocus id of its root node. Defaults to None.

You can, in fact, slightly modify the script  by adding an -a switch and the ID of a particular project to restrict the query to that project and its subtree. This will work if you only want to export a specific Project to mind-map; Contexts have a different subtree structure in OmniFocus’ database.

For instance, I only wanted to create a mind map for my MacStories project. To do so, I control-clicked on the project in the app’s sidebar, and selected “Copy As Link”; this will give you an OmniFocus URL like omnifocus:///task/oREye1BBxdg. The ID is the alphanumeric string after /task/.

Follow my tutorial, and add the -a switch as an additional filter:

python $HOME/ofoc_to_mindmap_018.py --output=$HOME/Dropbox/Maps/MacStories -m map.itm -c '0' --format=itmz -a oREye1BBxdg

Make sure to check out Robin’s script, as it’s much improved since the original release. You can also visit Robin’s website (and follow him on Twitter) for several AppleScript-related custom scripts and resources.

Permalink