Posts tagged with "automation"

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

Send Selected Mail Message To Evernote With Source URL

In trying out the new Evernote beta for Mac, I ended up looking for a way to quickly send a selected Mail message to Evernote. I knew it was possible with AppleScript, but after searching on Google, I couldn’t find the perfect solution that fit my needs. Fortunately, by combining this script with an old tip by John Gruber, I managed to assemble a simple AppleScript that does exactly what I want. Read more

Access Extra Content and Perks

Founded in 2015, Club MacStories has delivered exclusive content every week for nearly a decade.

What started with weekly and monthly email newsletters has blossomed into a family of memberships designed for every MacStories fan.

Learn more here and from our Club FAQs.

Club MacStories: Weekly and monthly newsletters via email and the web that are brimming with apps, tips, automation workflows, longform writing, early access to the MacStories Unwind podcast, periodic giveaways, and more;

Club MacStories+: Everything that Club MacStories offers, plus an active Discord community, advanced search and custom RSS features for exploring the Club’s entire back catalog, bonus columns, and dozens of app discounts;

Club Premier: All of the above and AppStories+, an extended version of our flagship podcast that’s delivered early, ad-free, and in high-bitrate audio.

Learn more here and from our Club FAQs.


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

Send Selected OmniFocus Task to Plain Text File

I save a lot of stuff into OmniFocus: bits of text, URLs, emails. I used to save favorite tweets into it, too. The app’s Quick Entry panel is so easy to invoke and so well-integrated with core parts of OS X  that, most of the time, I find myself clipping information that shouldn’t be into OmniFocus at all. However, I also find the process of manually going through that information beneficial to my workflow: it allows me to mentally and practically separate actionable items (tasks) from things to read and things to write (Instapaper material and my future articles, essentially).

I have created a simple AppleScript to send the selected OmniFocus task to a text file. The script is meant for how I use OmniFocus; hopefully you’ll find it useful as well. Feel free to modify it.

Typically, when I decide to go through my OmniFocus inbox, I find a lot of tasks that are actually ideas of things I want to do or write. Ideas don’t go into OmniFocus. Until those ideas become actionable items, I send them to a text file so I can elaborate on them and see if they can evolve. Like I said, most of the time those ideas are for new articles.

I store all my notes in a single Apps/ directory on my Dropbox. Based off the same AppleScript, I have created a Keyboard Maestro macro to create a new text file for each processed task; this is for ideas I know will turn out to be single, standalone articles. For ideas I’m not so sure about, I prefer to append them as text to an Ideas.txt file I keep in Dropbox as an “everything bucket” for inspiration. Read more

Access Extra Content and Perks

Founded in 2015, Club MacStories has delivered exclusive content every week for nearly a decade.

What started with weekly and monthly email newsletters has blossomed into a family of memberships designed for every MacStories fan.

Learn more here and from our Club FAQs.

Club MacStories: Weekly and monthly newsletters via email and the web that are brimming with apps, tips, automation workflows, longform writing, early access to the MacStories Unwind podcast, periodic giveaways, and more;

Club MacStories+: Everything that Club MacStories offers, plus an active Discord community, advanced search and custom RSS features for exploring the Club’s entire back catalog, bonus columns, and dozens of app discounts;

Club Premier: All of the above and AppStories+, an extended version of our flagship podcast that’s delivered early, ad-free, and in high-bitrate audio.

Learn more here and from our Club FAQs.