Thursday, 28 July 2016

Automator (OSX): 2 handy ideas

Automator is a tool shipped with OSX: it allows user to create simple applications that automates manual task. You can find some guide on how to use it, like this one.
Even if it is possible to record and save actions mad on the computer, I recommend to create the script manually.

In the last year I used this application for 2 scenarios.

Automatic launch applications for a Demo

When you create a demo for a presentation, it is important to be prepared and make no error: time is very important!
In november I did a speech with a final "demo".
The demo used a series of applications launched from the terminal:

The explanation of the above workflow:
  • opens a terminal
  • executes a command on the terminal (using keystrokes)
  • opens a new tab thanks to keypress [command + t]
  • executes another command
  • opens a third tab
  • keystrokes another command
  • opens the last tab, change the directory, launch a node script

Automatic Screenshots

Recently I subscribed an e-learning service with slides, available only online.
I wanted to have the same slides offline.
Thanks to automator it was possible to:
  • record the action to: select a window(the browser) and click on it. A click move the slide to the next one.
  • use screencapture to save in a predefined directory a screenshot of the entire screen. (using a bash command to build a unique filename each time).
  • repeat the step a variable number of times.
The script follows: