Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Recording keystrokes and mouse clicks?

Greetings,

I need to be able to make scripts/macros by recording keystrokes and mouse clicks with location.

Is this possible with Automator?

Does anyone know of a way program to do this?

It seems so simple.

Thanks

MacBook, Mac OS X (10.5.4)

Posted on Sep 9, 2008 7:27 AM

Reply
16 replies

Sep 9, 2008 2:02 PM in response to Chuck Risher

Copied from the help file - did you find it?

Recording your actions

You can create automations by having Automator record what you do. Automator can record your keyboard and mouse events and create a custom action. This new action, called a “Watch Me Do” action, contains the recorded series of events. When you run your workflow, the recorded events are executed.

NOTE: For Automator to record your actions, “Enable access for assistive devices” must be selected in the Universal Access preferences.

Open Universal Access preferences

To have Automator record what you do:

Before you begin recording you should consider where the recorded actions should begin. You may need to set up the environment before you start to record. For instance, if you expect that an application would be open when the workflow is used, then you should open the application before you begin recording.

In an Automator workflow, click Record. The Automator:Recording message appears with the stop button.

Perform the series of steps that you want recorded.


When you have finished the steps you want recorded, click the Stop button.


Click Run to test your recorded actions.


You can adjust the settings of the action to change the way your recording performs:

■ If you want to remove an event from the list, select the event and type Delete.

■ If you want to set a timeout limit for user action, adjust the Timeout using the up and down arrows.

■ If you want to change the speed the recording plays back, adjust the playback speed using the slider.

Dec 16, 2013 2:24 AM in response to Chuck Risher

Precisely the same problem. I drag the screen to top left but when I play back it clicks mouse then moves it - does not function correctly for drag recording.


Is there a short cut key sequence like the home function most apps have to get to top left corner to over come this - you want all macros to start at a known point.


Also the step button just runs the whole work flow not one step at a time and the shortcut CTL+. does not stop an out of control macro from excuting any further. These I would think would be basic functional requirements of a macro language (known start and stop and basic debugging). So far this tool is very disappointing. Only simplistic functions work reliably.

Feb 10, 2015 2:04 PM in response to TomU

Although a given Record/Watch Me Do action in any workflow may work, it's also likely to fail. It's important to understand that the Watch Me Do action records mouse and keyboard actions as they take place on screen. If the (aptly abbreviated) WMD action doesn't find the expected screen elements--everything just where it first was when the recording was made--it will usually give unexpected results or just abort. In other words, WMD doesn't, for instance, look for an open TextEdit document, identify a line of text, and then navigate the menu to Edit > Cut, etc. It simply navigates to a screen location and tries to type/click/drag/etc. as it has been instructed in that spot. A few pixels off or if the menu bar has changed because TextEdit is no longer the foreground application, boom!

Feb 11, 2015 5:52 AM in response to TomU

Be sure that you're precise as you select the menu bar (File/Edit/Format/etc.) item. If you "glide" over Format and momentarily activate the Format submenu before you come to Edit and its submenu, WMD may reference Format as a navigation anchor.


Consider surer keyboard-shortcut approaches that would use, for example, Command-X for Edit > Cut.


Or, if Automator is indeed performing one-menu-over "consistently," BDAqua's approach could work, too.

Feb 11, 2015 6:41 AM in response to mns579

Keyboard shortcuts were often missed. For example, I tried this sequence many times.

0: (setup: text editor is scrolled to first line and cursor is at the beginning of the first line)

1: Click on text editor window to focus it.

2: press SHIFT-DownArrow to move cursor down one line and select the first line

3: press CMD-X to cut the line.


Automator never would capture those key strokes.


But today I has a break through. This sequence does work:


0: (setup: text editor is scrolled to bottom of the file and the cursor is placed below the last line.)

1: Click on text editor window to focus it.

2: press SHIFT-UpArror to move cursor up one line and select the last line.

3: press CMD-X to cut the line.


about 70% of the time this did get recorded correctly (I did maybe 3 recordings and one failed to select). Once it got recorded correctly it worked reliably.


So it seems to be able to capture some sequences but not others. Both sequences work very reliably when I type them but automator can only capture the last sequence.


Thanks for the suggestions. This tool is better than nothing but not anything I would recommend.

Feb 11, 2015 8:01 AM in response to TomU

Good to hear.


Sometimes it helps to move slowly so that Automator captures everything. I do agree with you though: Automator is sometimes unpredictable yet better than nothing for the nonprogrammer. It's certainly easier than learning AppleScript, which is the path that a programmer would take to create a more reliable, robust procedure than Automator's WMD can produce.

Feb 11, 2015 9:17 AM in response to mns579

I'm actually a programmer for 25 years but can not figure out AppleScript. I've worked in all sorts of environments, C, Unix, Java, Window, Mac, C#, .NET. No problem. But there is something about how AppleScript is structured that I can not understand. I have not yet grasp the organizing principle of the language. It escapes me. Thus, I must fall back on Automater to watch me. Sigh...

Recording keystrokes and mouse clicks?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.