The Podcaster Macro

September 23, 2012 by Gabe | [mmd] |

Now that I am some sort of "podcaster" I'm realizing how annoying it is to record through Skype on a Mac. Skype is offended by every other application. It's like a jealous wife insisting on being the the only application in my life. To accommodate Skype's temper tantrum's I've created several macros to prepare for a recording session. I've already written about my Keyboard Maestro macro to toggle the audio input and output devices.

Before I record, I disable the following applications and services1:

Some of these are easy, because they are standard applications. But Hazel and Backblaze are system preferences so they need some strategic AppleScripting.

Hazel was particularly difficult because it has nested object groups and buttons. Here's a couple of tricks to use for getting at objects. First, read Dr. Drang's post on the Accessibility Inspector. Next, I reuse some scripts to inspect objects in a window. For example, to figure out the pane id for a preference panel, I use this script:

tell application "System Events"
    tell application "System Preferences"
        get the id of every pane
    end tell
end tell

Which provides a result set containing every id:

That's simple enough. I wanted to write a script to disable Hazel since it handles a lot of automated scripts that might consume bandwidth, CPU and irritate Skype. I thought it would be easy enough to switch to the "Info" panel of the Hazel window. To inspect all of the anchors I run this script:

tell application "System Events"
    tell application "System Preferences"
        get every anchor of pane id "com.noodlesoft.Hazel"
    end tell
end tell

Unfortunately, the only anchor missing is the one I want.

It took some investigation but I discovered that the "Info" button is in a radio button group. The next problem I had was clicking the "Stop Hazel" button. This too was awkwardly nested.2 It's a button inside a group, inside a group in the main window.

Once I figured this out, I had a complete AppleScript for turning Hazel off:

tell application "System Preferences"
    activate
    set current pane to pane id "com.noodlesoft.Hazel"
end tell
tell application "System Events"
    tell process "System Preferences"
        set frontmost to true
        click radio button "Info" of radio group of window "Hazel"
        delay 1
        click button "Stop Hazel" of group 0 of group 0 of window "Hazel"
    end tell
end tell

The above discussion should serve as a basis for understanding my complete macro for disabling applications and services.

Here's a script to turn off Backblaze:

tell application "System Preferences"
    activate
end tell
tell application "System Events"
    tell process "System Preferences"
        click menu item "Backblaze Backup" of the menu "View" of menu bar 1
        delay 2
        click button "Pause Backup" of the first group of the window "Backblaze Backup"
    end tell
end tell

I've also included a macro action to disable the Mountain Lion notifications with a little Keyboard Maestro magic. There is a new action that can use an image to identify a location on screen to click. Using a simple mouse location fails to register the "option" key during the click. Even this action is very finicky.

The entire macro does the following:

  1. Quit all open applications
  2. Quit Dropbox
  3. Quit TextExpander
  4. Activate Piezo
  5. Activate nvALT
  6. Switch my audio sources to my Rode Podcaster
  7. Disable my Keyboard Maestro scheduled macros
  8. Disable Hazel
  9. Pause Backblaze
  10. Pause Growl
  11. Disable Mountain Lion notifications

This is easy enough to reverse, so I am only showing one macro of a pair. When I get ready to record, I trigger one macro. When I'm done, I trigger the other.

Here's the macro to setup for a podcast3

Here's the macro for when I'm done:


  1. These services either create unnecessary network traffic or produce unnecessary noise. 

  2. This is in no way a problem with Hazel. GUI scripting is hacky and most app developers don't consider ham-handed stuff like this and if they did, it should be pretty low on the list of priorities. 

  3. I'm pretty sure this macro could be considered a hate crime. 

blog comments powered by Disqus