Microsoft Word Find and Replace All - Press OK Button

I can't seem to figure how to overcome Word's annoying notification popup. After I press Replace All button, a notification pops up "All done. We made 3 replacements."

If I press the Enter key, it goes away. However, simulating the Enter or Return keystroke via KM does not seem to work.

Word Replace All.kmmacros (6.4 KB)

Worked for me, but took about 4 seconds to dismiss it.
I disabled the Failure Aborts Macro action because that seems to block the next actions.

Seems like pressing a button slows the actions, possibly making the macro fail:

Is there a button on the popup?
If so, then use these KM Actions:

  1. Pause Until Button with <button name>
  2. Press Button with <button name>

The Press Button action is actually synchronous to the button, so the engine does not proceed until the action of the button press completes, which may be instantaneous or may be after the target application finishes processing whatever the button causes to happen, depending on how the application is written.

1 Like

Hey @slyfox,

Yuck! What a mess...

Word's accessibility is less than perfect. It hangs for 5-6 seconds after the replace-all button is pressed.

I got around this by combining AppleScript UI-Scripting and Keyboard Maestro actions.

I'm using Word from Office 2016, and I can't guarantee the UI-Scripting will work properly in different versions.

If I was doing this regularly I'd script the find/replace.


Microsoft Word Replace All v1.00.kmmacros (8.7 KB)

1 Like

damn, lots of code

A post was split to a new topic: How Do I trigger Macro when dropping a file into a folder?