I've read a couple of answers about this topic in the forum; however, something seems to be missing in the responses.
I want to Erase deleted mail from all accounts. My macro periodically brings Mail to the front, "Selects" the appropriate menu and sub menu item. No issue there. The result is a dialog with buttons to either "Cancel" or "Erase" the mail.
I've added the action "Press a button" and typed in the button name. Nothing happens. According to prior posts, KM will scan the app looking for the button, so I have Mail running and the dialog front and center. I don't see that KM is doing any scanning.
So, what is the secret to simply pressing a button in a dialog? The action "Press a button..." doesn't seem to do anything.
That may be the problem. Many apps don't name their buttons by the same name that you see on the screen. The way to ensure that you have the correct name is not by typing it in, but by pressing the word "Button" in the action and then "scanning" the app in question (Mail, in your case), and then going back to the same menu, hovering over your app's name, (the one at the top of the menu) and then finding and clicking on the appropriate button name.
Try this and there's a chance it will fix your problem. You should always be doing it this way, even if it doesn't fix your problem. Typing in a name manually should only be done when you are certain that you have the right name.
That's similar to what I've read: How do you "scan" the app?
Clicking the word "Button" in the action doesn't do anything - see graphic of what I'm pressing.
I have the dialog open and off to the side on the same screen as when I click on the word "Button" but I still don't understand how you scan.
What version of Keyboard Maestro do you have? It should look like this:
-rob.
I have version 10.2.
It's not clear from where in Mail messages are being deleted. That's okay. Note there's a built-in method for deleting messages from any mailbox.
If messages are selected, pressing Option-Delete skips sending messages to the Trash mailbox and immediately deletes them. Deleting messages this way—presumably using the Keyboard Maestro action to Simulate A Keystroke—may work around the original issue described here.
You'll have to upgrade—it was added in 11.0.1. (That is, if you want to use the button feature with the scan option. Or @Nige_S' solution avoiding the buttons entirely).
With all that said, try Title:Erase
and I bet it works.
-rob.
I'll give @Nige_S method a try. I would have thought that pushing a button on a dialog would have been one of the very first things a keyboard tool could have done! It must be much more complex than what I see superficially as a user.
I have used a macro recorder that does this relatively easy but it is 4 times the price of Keyboard Maestro - so I guess I'll be upgrading to version 11.x.x shortly
It is something it's been able to do, at least since version 10. But version 11 added the scan feature, which makes it a much more capable tool. I used it to find Title:Erase
, which is why I'm confident it'd work for you.
-rob.
The problem is "which button to press" -- as @griffman noted, the button name we see often isn't the same as the app uses internally so you have to do some digging. The v11 "scan" feature has made that much easier, and v11 is well worth the upgrade anyway, but while you get that sorted using "Title:Erase" should work if you are using the latest Mail:
That may be different in previous versions, so let us know if you aren't running Sequoia.
You could also go "old school". When that dialog appears the "Cancel" button is selected -- all you need to do is tab-and-Return to hit "Erase":
I appreciate all the help here!
I will upgrade my KBM