Help with Keyboard Maestro shortcut

Hi gang,

I am still a KM noob, even though I have used it for many years. I know it has huge potential, but haven’t got past the initial steps.

Now I want to create a shortcut that presses the not default button in a dialogue. So I let KM record was I was doing and tried to build a shortcut from there, but I couldn’t. Hence this post, please help me.

In Filemaker there is a dialogue called “Replace field contents…”. The default button is Cancel (because you may easily eff up a lot of database records, while the one you want to use is a button called “Replace”. See screenshot.

I want KM to press the Replace button for me, no matter where on the screen the dialogue is, or on which screen (I usually work with two monitors).

I also want the shortcut for this to only be active when this dialogue is the frontmost.

How do I solve this?

Skärmavbild 2024-01-01 kl. 16.34.24

My attempt, that doesn’t work (it clicks outside the dialogue):

First thing that comes to mind is a KM action that lets you search for screen content. So basically your KM macro only continues once KM finds screen content you define via a screenshot. And it then lets you define coordinates in this screenshot where to perform a click. This way you can trigger your Replace button on the dialog no matter where it is.
(On my phone currently so can’t say exactly what the KM action is called, sorry).

1 Like

Maybe try this. Change the names of the buttons to "Replace and “Cancel”.

2 Likes

How about using the built in macOS feature for this? Full Keyboard Access on macOS

1 Like

Thanks, I have never been able to use that. By some reason my brain don’t want to accept it as a solution (probably because it involves more keyboard presses than just a simple shortcut)… :crazy_face:

That works! :1st_place_medal::+1:

But – I don’t want it to pause until the conditions are met, rather “If the conditions aren’t met, don’t do a thing”.
(Because otherwise it will trigger the next time I open the Replace Dialogue, I just tested)

Or, maybe I just assign it a not very common shortcut and just use the “Press Button ‘Replace’” action.

Thanks!

1 Like

Does Filemaker accept command-R and command-escape (in this case the return key) at the dialog input? If so, you KM macro simply needs to type command-R.


JJW

I am not sure that I understand you correctly. Pressing COM+R in this dialogue don’t do anything (even though I am aware that some dialogue buttons have hidden shortcuts normally assigned to the first button character (not in this case though)).

COM+R is a shortcut for another thing in Filemaker (“Modify Last Find” used when searching for records), not available when in the Replace Dialogue.

Thus it could work, depending on how Keyboard Maestro will react when you not are in the Replace Dialogue. That is what I meant with “If the conditions aren’t met, don’t do a thing”.

Ie, when pressing COM+R, do this:

  • If you are in the Replace Dialoge, press the Replace Button.
  • If not, use the built in application shortcut for Modify Last Find.

All that I am saying is, if the dialog accepts keyboard shortcuts for button clicks, consider using the keyboard shortcuts. Since your dialog does not accept keyboard shortcuts, you cannot use a keyboard shortcut.


JJW

1 Like