15

How can I use the built in tool, Automator (rather than a 3rd party app), to create a simple keyboard macro?

For example, I want it to press Cmd-Shift Left, then Cmd-U, then Right, etc.

I tried using the record feature to create this macro, but ran into several problems.

The first is that it's copying my mouse events after I press record and as I go into the application I want to run the macro on. For example, in this case I want to run it in Chrome. I ended up deleting the first few steps which involved launching chrome. The reason I deleted them is because I don't want it to be limited to a specific application, and I think that it just adds to the complexity if it tries activating an application. I want it to stick with running keyboard commands only.

The second problem is that I'm not sure how to initiate the keyboard macro. Do I save the recorded file? Where to? How do I invoke the macro once I am in Chrome? Is there a way to assign a keyboard shortcut to it?

  • I would recommend Keyboard Maestro, it does exactly that. – user14492 Feb 24 '16 at 16:39
16

If you don't want to use any third party apps you are really complicating your life. Although I think it's possible.

1) Open Automator and create a new Service. In your workflow you want to Run Applescript. In there you tell it to press the keys you want. enter image description here

Once you save it as a Service you can then set up a keyboard shortcut for it in System Preferences. It should automatically show up under the General group. Make sure it's enabled and give it a keyboard shortcut. enter image description here

I have gotten this to work by testing the Show history function Cmd-Y. Hopefully the above isn't too cryptic.

If you want to set global shortcuts and run scripts you might want to look at BetterTouchTool: http://blog.boastr.net/

  • This used to work, but recently seems to have stopped (Sierra, 10.12.6). Running the service from an app's Services menu shows the little cog in the top system menu so I know it is running, but nothing happens. Is it just me? – Don't Panic Dec 14 '17 at 9:11

You must log in to answer this question.

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