I am trying to make an app in Automator to hide or show the top menu bar and dock. I couldn't think of a better way to do it, so I used the "record" function so it could watch me carry it out. I tested it in automator, and it worked fine.

Here's the workflow: Workflow

Like I said, it works fine when I hit the "run" button in Automator, but when I export it as an application, it opens System Preferences, but stops working as soon as it hits the "Watch Me Do" function, and gives me this message:


Here's a video of the whole thing if it helps:


2 Answers 2


Watch Me Do and Accessibility

Since macOS 10.9, you need to add your Automator application to your Mac's accessibility list. To add your Automator workflow, go to:

  • System Preferences →
  • Security & Privacy →
  • Accessibility

…and drag the Automator app you are trying to use into the list.

This is needed because Watch Me Do uses macOS's accessibility features to simulate user interactions. Accessibility is powerful and Apple require applications be explicitly listed before they are granted this additional control over your computer.


Forget using Watch Me Do, it's kludgy and slow. You can use the following AppleScript code to toggle the state of the Menu bar and Dock.

Assuming that the state of both the Dock and the Menu bar are in sync. In other words, they are both always either showing or hidden together under normal usage and as such this script toggles the state of each to the opposite of the current state prior to its execution. If that is not the case, then additional logic needs to be applied.

tell application "System Preferences"
    reveal pane id "com.apple.preference.general"
    delay 1
end tell

tell application "System Events"
    click checkbox "Automatically hide and show the menu bar" of window "General" of process "System Preferences"
    key code 12 using command down
    tell dock preferences to set autohide to not autohide
end tell
  • Same issue. It works fine when running form automator, but when saved as an app and then ran, it gives me the message "The action “Run AppleScript” encountered an error."
    – RothX
    Sep 29, 2016 at 13:52
  • 1
    Never mind, I got it to work. I needed to allow the app to control the computer with the accessibility thing. I should look into AppleScript more, thanks.
    – RothX
    Sep 29, 2016 at 14:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .