Controlling the GUI via Automator

As a follow up to the previous post, there’s a simpler way to achieve the same result by skipping the AppleScript and just using Automator.  I’m going to assume you know the problem already from the previous post – this one will just contain the alternative solution.

The “Watch me do” action of Automator allows you to record GUI interactions as part of an Automator workflow and play them back at will.  So, the alternative solution to creating a print to preview service for Firefox is to simply record such an Automator workflow and use this as an action.  To begin with, create a service in Automator – this should be familiar from these posts – as shown in Figure 1:

Figure 1: The record button - highlighted in the blue oval - allows the recording of a "Watch me do" action.  The red oval highlights the input setting: it is important that this is set to no text to use this as a service.

Figure 1: The record button – highlighted in the blue oval – allows the recording of a “Watch me do” action. The red oval highlights the input setting: it is important that this is set to no input to use this as a service.

One subtlety is that, if you save this service prior to setting the input to “No input”, the service will not be recognised as being valid unless you have some text selected, even if you subsequently change this setting and re-save the workflow.  Now click the record button, then go through the actions required to open the current Firefox document as a PDF in preview, and finally hit stop recording.  You should see something akin to Figure 2:

Figure 2: Workflow immediately after recording the actions needed to open the current Firefox document as a PDF in Preview.

Figure 2: Workflow immediately after recording the actions needed to open the current Firefox document as a PDF in Preview.

If you run this automator workflow, you’ll see that it works, but is slow. It can be accelerated by setting a few options as shown in Figure 3, and I suggest setting it to only work in Firefox rather than any application (not shown):

Figure 3: Updating settings to speed up the action.  The timeout setting in the red oval needs to be set for each step in the workflow, while the playback speed setting highlighted in blue, only needs to be set once for the entire workflow.

Figure 3: Updating settings to speed up the action. The timeout setting in the red oval needs to be set for each step in the workflow, while the playback speed setting highlighted in blue, only needs to be set once for the entire workflow.

This can now be set up for a keyboard shortcut, as shown in the posts linked above. This yields a complete process for using a keyboard shortcut within Firefox to open the current page as a PDF in Preview.

Advertisements
Tagged with: , ,
Posted in Firefox, os x
One comment on “Controlling the GUI via Automator

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Hacks for Macs

Neat tricks and advice for making OS X work for you

The Mac Observer

Apple iPhone, Mac, Watch and iPad News, Opinions, Tips and Podcasts

MacOSXHints.com

Neat tricks and advice for making OS X work for you

Mastering Emacs

Neat tricks and advice for making OS X work for you

The WordPress.com Blog

The latest news on WordPress.com and the WordPress community.

%d bloggers like this: