How To Create Pause Until Condition With A Parallels App

I am creating a macro using Adobe for Windows in Parallels and I need to pause the macro until pressing SAVE in the Windows dialogue box for saving a file.

I was thinking of double clicking the SAVE button in Windows to i ) save the Windows file and ii) act as a Keyboard Maestro trigger to resume the macro as detailed below.

I would appreciate comments / thoughts on i) whether the below will work or ii) whether there is a better way.

+++++++++++++++++++++++++++++++++

Step 1: Create a Dedicated Macro Group

To ensure the double-click only triggers the macro when I am in the Adobe environment:

  1. Create a new Macro Group called "Adobe."
  2. Set the Adobe Macro Group to only run for Adobe.

Step 2: Create Macro B (The "Resume Listener")

This macro monitors for the double-click event.

  1. Create a macro named Control Pause in the Adobe Macro Group.
  2. Trigger
  • Select USB Device Key Trigger and set double-click of the left mouse button.
  • Set to is double tapped.
  1. Add the action Set Variable "Adobe_State" to "Resumed"**.

The idea here is that the double-click will hit the SAVE button in Adobe and trigger this macro simultaneously.


Step 3: Create Macro A (The Main Workflow)

This is the Adobe automation that needs to wait for the double click.

  1. Create the actions.
  2. First Action; Set Variable "Adobe_State" to Paused to ensure the macro doesn't accidentally skip the pause if the variable was left over from a previous run.
  3. Workflow Actions:These are the actions that lead up to the Adobe dialogue box appearing.
  4. The Pause:
  • Add a Pause Until action.
  • Condition:Select Variable and set it to Variable Adobe_State is "Resumed”
  1. Click the Gear (:gear:) icon on the action and uncheck "Reduced CPU" so there is no delay when SAVE is double clicked.
  2. Workflow Actions; These are the actions that occur after the dialogue box closes.
  3. Set Adobe_State to %Delete%.

++++++++++++++++++++++++++++++++

Can you not, at the appropriate point in your macro:

  1. "Pause Until..." image detection can "see" the Save button (that gives the dialog time to appear)
  2. "Pause Until..." image detection can no longer see the Save button (it's gone because you clicked it)

It seems a whole lot simpler!

The above does assume that Windows app-in-Coherence-mode buttons can't be detected by KM's "Button" Conditions, so try those instead of image detection -- if they work they'll be more reliable.

A few things as I did some testing:

  1. Confirming that Keyboard Maestro's Button Condition does not detect buttons within Windows applications running in Parallels.

  2. Tested a number of different Pause Until conditions and the one that seems to work best is "Pause Until the Left Mouse Button is Clicked" (i.e., the SAVE button is clicked).

Interesting to note that this approach appears to be robust in that the macro is paused until the earlier of:

a) Clicking the CANCEL button (and the macro exits);
b) Clicking the SAVE button (and the macro continues);
c) Pressing ENTER (and the macro continues because SAVE is the focus button); or
d) Pressing ALT+S (i.e., the shortcut for SAVE) (and the macro continues).

Thank you for getting me to think more about this and arrive at a simpler solution!

Will be more certain of this with more testing though.

+++++++++++++++++++++++++++++++

PS. I am trying to stay away from "Image detection" as much as possible because it is not always reliable. I have -- it has taken some work -- been successful in using a combination of arrow commands, hot keys, keyboard entries and the like to eliminate all "image detection" action in Windows applications.

In fact, the only place I have not been successful with this is the macOS display preset change which has 3! :frowning: