At the request of listeners I’m going to be publishing a big list of links with future Let’s Talk Apple shows. The logical format for me to create those notes in is Markdown – it’s plain text, and quick and easy for me to add new items and re-arrange them into logical groupings. for the most part markdown has little to no overhead, but when it comes to links there is a little work. What I wanted was a way of automatically taking a URL, and turning it into a markdown link where the text for the link is the site the story is from with /… after it.

When all is done I want to turn a url like into a link that looks like:…. In other words, I need to take the URL above as input, and turn it into the following Markdown code:

My reason for choosing this format is that I want to give obvious credit to the sources of the stories, but not waste screen real-estate on long URLs.

Perl’s URI module can interpret URLs, and easily extract the host part of the URL, OS X Services can take selected text as input and replace it with processed output, Automator can create OS X Services, and Automator can execute Perl code. By putting all these pieces together I was able to solve my problem in just 20 minutes with a few clicks and a few lines of code.

You can just download the service with the link below, or you can read on to see how it’s done.

Download OS X Service …

Read more

Tagged with:

In a recent Chit Chat Across the Pond segment on episode 484 of the Nosillacast Mac Podcast myself and Allison walked through the process of creating an automator action for generating secure memorable passwords with the XKPasswd 2 perl module (we basically walked through the steps in this blog post). During that discussion Allison mentioned it would nice if Automator could play a sound when it was finished so you could know when automator was done generating the password without installing a third-party notification app like Growl.

At the time I didn’t know of a way to do that, but now I do, and it’s really quite straightforward thanks to the OS X terminal command afplay which will play an audio file without opening any sort of GUI.

Read more

Tagged with:

It’s going to take me a few months to re-write the site so it uses the new XKPasswd 2 perl module. In the mean-time, thanks to the magic of Automator an OSX Services, Mac users can integrate XKPasswd 2 right into their OS with out very much effort at all.

This blog post is intended as a follow-on post to my earlier XKPasswd 2 beginners guide. This post assumes you have followed the installation instructions in the beginner’s guide to install the XKPasswd 2 module, that you followed along with that post and created a script that generates passwords in a format of your choice, and that you have tested that script to be sure it works. In this post I’ll be using the final example script from the beginner’s guide as my pre-written script.

Read more

Tagged with:

Inspired by a recent episode of The Mac Cast I decided to see if I could come up with a simple way of getting a word count of a PDF on OS X using only tools that come standard with the OS.

Because of OS X’s Unix underpinnings, all Macs have access to the Unix wc command which calculates word counts on given input. OS X also has a handy built in Terminal command to access the contents of the clipboard (pbpaste). This leads to an obvious simple manual solution:

  1. Open the PDF in Preview
  2. Select All Text
  3. Copy to clipboard
  4. Run the Terminal command: pbpaste | wc -w

This is a bit cumbersome though, so I went on to create a simple OS X Service to calculate the word count of any selectable text in any app (the fact that this is even possible, let alone easy, is why I love OS X).

For those of you just looking for a copy of the Service, you can download it here:


To install the service simply extract the automator file from the ZIP archive and copy it into either the Library/Services folder in your home directory, or the system-wide service folder /Library/Services.

Once the Service is installed you can use it in almost any OS X app (specifically in any app written using the standard Cocoa libraries) by selecting some text, right-clicking on it, and selecting the Word Count service:

Right Click Selected Text to Invoke the Service

When done the results will look something like this:

Sample Output

Those of you who want to see how easy this Service was to write, read on and I’ll walk you through it.

Read more

Tagged with:

Back in 2011 I wrote a blog post explaining how to create an OS X Service for stripping keywords from image files. In this post we’ll use the same technique to create a Service for stripping geotags from JPEG images.

As with the keyword stripping service, there are two prerequisites for this action, one is required, one is optional. You absolutely MUST have install EXIFTool installed, and it would be good if you also had Growl installed, but it’s not essential.

Read more

Tagged with:

Automator + XKpasswdA few weeks ago on the Chit Chat Across the Pond segment of the Nosillacast, I mentioned that I had an OS X service set up to generate a random password using my XKpasswd Perl module and copy it to the clipboard. Listeners enquired as to how they would go about doing that, so as promised, here’s a quick tutorial.

Obviously this tutorial is for Mac OS X users only, because OS-wide Services and Automator are OS X features. The screenshots are taken on 10.8 Mountain Lion, but this same technique definitely also works on OSX 10.7 Lion, and probably even on 10.6 Snow Leopard. This tutorial also assumes that you have downloaded the XKpasswd module, and saved it somewhere on your computer, along with either the sample dictionary file included with the module or one of your own making, and that you know where on your computer those files have been saved. In other words, you need to have and a text file with one word per line somewhere on your hard drive. In my sample code I’m going to assume you’ve installed the Perl module to the suggested location, /usr/local/xkpasswd/, and that you have customised the sample dictionary a little (more secure that way), and saved it to /usr/local/xkpasswd/dict.txt.

Read more

Tagged with:

Following on from my post yesterday with three examples of using Automator to create Services, and some good suggestions in the comments, I spent some time this afternoon making the script in the third of those examples a little more efficient, and a lot more robust.

The Service I optimised was the one to strip keywords from image files. This Service assumes that both Growl and EXIFTool are installed, and that you’re running OS X 10.6 Snow Leopard or later.

Read more

Tagged with:

Automator IconSome Apple haters just love to say that there is nothing to a Mac except for flashy marketing. There are a million different reasons that’s BS, but one in particular is ease of automation. The learning curve to start automating your Mac is very short and very gentle. Without ever seeing a single line of code you can add your own custom functionality to OS X to relieve you of your most boring repetitive tasks. If you can tolerate seeing a line or two of code, you can take things even further and tie Unix command line tools straight into your GUI. The best candidates for automation are simple repetitive tasks that you do often. You might only save 30 seconds each time, but if do that 10 times a day that soon adds up! In this post I just want to give three simple examples to whet your appetite and hopefully get you thinking about some simple tasks in your computing life that you could easily automate.

Read more

Tagged with:

Since I first started using OS X at version 10.3 I’ve always felt that the services menu had great potential but badly needed some fit and polish to make it actually live up to that promise. It has been so bad that it is basically forgotten, and almost no one remebers that it even exists. In every application in OS X there is a menu item under the apps’s main menu (the one in bold with the same name as the app) called Services, that’s what I’m talking about. When it comes to the services menu both Tiger and Leopard were major disappointments because they didn’t bring any real improvement to the neglected services menu. SnowLeopard on the other hand is a totally different story. Similarly, when Automator first came out I thought it had great promise, but that it was a very 1.0 kind of offering, again, in need of some fit and polish to allow it live up to its obvious potential. SnowLeopard provides a lot of that fit and polish, and really brings Automator forward significantly. And what’s better, Apple have combined the fit and finish in these two apparently unrelated products together, to provide some exceptionally powerful functionality.

Read more

Tagged with:

When OSX came out there were three new features that Steve ranted on about. The first was Spotlight, which I use a lot and really like, the second was Dashboard, which a quick scan of the articles in the Mac section of my blog will clearly show I like a lot, and the final one was Automator, which I’ve really neglected. I never even bothered to play with it properly until today! But, better late than never and since I had a free hour and some backups I wanted to automate I figured I’d give the classic rsync shell script approach a miss this time and see what Automator could do for me.


In case you’re not familiar with Automator the idea behind it is that you can write scripts to automate repetitive tasks or tasks that you do a lot but without typing or seeing a single line of code. For the full Apple hype have a look at the Automator page on the Apple Site.

So, the question is, does Automator live up to the hype? Well IMO it does. It did take me a few minutes to get into the swing of things and I have to say I’d probably never have figured it out without looking at the sample workflows but once I got into it it was dead easy. You just drag and drop in the actions you need in the position you need them and then tinker with the options on each action until you have what you need. Something I found really helpful was that you can create complex workflows by chaining together simple ones. I initially started by trying to write one killer workflow that would deal with all elements of my backup but I soon realise I would be much better off breaking the task up and then creating the killer workflow by adding together all my small workflows.

My Experimental Workflow

I wanted to back up to a SAMBA share that is not that big so I was only interested in backing up important stuff. To me important stuff meant:

  1. My email
  2. My FireFox bookmarks
  3. My Work Documents

So, I started by creating a simple workflow to archive my Thunderbird folder to my desktop, move it to a folder on the share and then re-name it with the current date. Then I used that as a base for creating similar flows for my FireFox settings and my documents. Finally I tied all this together with a flow that did the following:

  1. Connected to the samba share
  2. Ran the three backup flows
  3. Ejected the samba share

Within 30 minutes of starting to play with Automator for the first time I had the above done, tested and working. I can now very easily and very quickly backup my important stuff to my samba share.

Below are some screenshots of some of my workflows to give you an idea of what the interface is like.

Automator Workflow for backing up Email

(above) The workflow for backing up my email.
(below) The workflow that ties all my small workflows together

Automator Workflow for backing up all my important data

Not Perfect

However, there are a few things that annoyed me, firstly, Automator crashed once when it had just finished saving a workflow. I’m not accustomed to Apple programs crashing so that worried me a bit but it only happened once and since then I’ve been poking around with automator for hours with no more crashes. The other thing is that I can’t get the action for disconnecting from the share to work. I’m not sure if the problem is with Automator or with OS X’s samba. Mind you samba support on Tiger has been flaky to say the least so it doesn’t really surprise me that Automator has some issues with it. The important thing is that it can connect to the share which it does without problems.


Automator delivers on it’s promise of letting you do powerful things all within a simple drag and drop interface. The range of actions available is simply phenomenal ranging from simple sysadmin tasks like moving and copying files or running shell scripts to automatically burning backups to CD and automatically processing entire folders of images. Automator also integrates with just about every Apple program so you can automate more tasks than I could possibly describe here. To get some idea of how many actions there are have a look at the screenshot of the action browser pane below. Yes, it crashed on me once but I’m still very happy with it and will be using it a lot.

Some Automator Actions

Tagged with: