Automatically press a prompt/dialog button

Is there a way to get KM to "Automatically press a prompt/dialog button" whenever that dialog comes up? For example, the attached photo below is from Adobe Lightroom. I would like the button "Delete from Disk" to be pressed every time the dialog opens.

Sorry if this is answered somewhere, I have searched a fair amount and not found the solution.

Thanks (and Merry Xmas, Happy Holidays :),

d

Something like this should work:
Press button.kmmacros (24.1 KB)

Although you mentioned it running automatically. I am not actually sure what the best way to do that is.

Yes, the detecting the prompt is really the main question I have. It would be nice to trigger on when that dialog/prompt opens and then click the button.

Though I guess in this case I can write a script to do the keyboard press for delete and then press the button in the resulting dialog box as you suggest.

You might try a trigger of Focused Window title changes (KM Wiki). Some prompts will have a title, others won't. If yours does, then just test for that title. If not, test for a blank or empty title, then test for existence of the button of interest.

Of course, you would want this macro in a Macro Group which is activated ONLY when your app is active/frontmost.

1 Like

Just in case you didn't know, Cmd D will trigger the 'Delete from Disk' button.

Hello David (@reesd) :wave:

Another thing you could try is building some kind of loop into your Lightroom Macros and a handling based on detection of appearance of this button …

It is possible with only KM‘s native actions but sometimes you need to try using AppleScript to detect the window and press the button if it gets detected.

I’ve read about this stuff a long time ago …

Since I don’t have Lightroom I can not test this but I think my suggestions should point you on the right track - and give you insights on how such things could be done.

Greetings from Germany

Tobias

If you don’t have UI Browser to inspect the UI or you can not get it to work properly here is a wonderful Macro which can you help with getting the dialogs properties an other information for Scripting with AppleScript

Greetings from Germany

Tobias