Macro causes extra keystroke effect

I built this simple macro to make a keyboard trigger to click "Don't Save" in a dialog box. Currently, Apple allows developers to name the button "Don't Save" "Delete" or "No." So I built this little conditional macro.

It works fine, except that before it clicks the Don't/Delete/No button, it gives the dialog box the CMD-D to shift focus to the Desktop. I realize I could fix this my just changing the trigger key, but I want to understand why it does this.

Thanks!

Simulating a keystroke that is also the trigger to a macro (⌘D in this case) does not have well defined behaviour.

The simulated keystroke may either cause the macro to run, or may be sent through to the system for processing, and which it is may vary over time depending on the loan of your Mac.

That said, I don't know why it would both shift to the desktop and click the button in this case - which particular window is this that you are operating on?

In any given app, the "Save Changes" window that opens when you close or quit with unsaved changes.

Why would ⌘D display the desktop in a “Save Changes?” dialog box?

1 Like

I think it's a system thing for any open/save dialog. Cmd-D navigates you to the Desktop.

Yes, but we're not in a Open/Save dialog at this point, this is before that with the "Save Changes?" dialog, and ⌘D does not work at that point, hence my confusion. Are you in an Open/Save dialog, or a “Save Changes?” alert?

My mistake.

It's a drop-down dialog that says "you can choose to save your changes or delete this document immediately." It has a save interface below, with four buttons: Save, Cancel, Delete and New Folder.

Cmd-D navigates to the Desktop in this dialog.

Well, as far as I can see, with that macro active, it should swallow the ⌘D and unless the Type a ⌘D Keystroke action runs, then there should be no shift to the Desktop.

Add a Log action before each action and see what is being executed. You can see the log output in the Engine.log file (Help ➤ Open Logs Folder).