Pause until "Save" button pressed

I'm trying to create a macro to save attachments in Apple Mail and then remove the attachments from the message.

Pressing Cmd Alt S initiates the macro and I get the Save dialog, which is the way I want it. Once I've selected the required folder and pressed the Save button, I want Mail to remove the attachments.

I started by setting the macro to "Pause until condition met > A button with the name "Save" is enabled.

This doesn't seem to work for some reason. Should this action work in a save dialog?

I could select Pause until Enter button pressed but sometimes I press Enter and sometimes I click the button with the mouse, depending on whether I've got an external keyboard pressed. Any suggestions?

Thanks in advance,

Steve

“Pause until enabled” doesn’t mean “pause until the save button is pressed” , just that the”Save” button is available (assuming that the “pause until…” action works in a Save dialog - I didn’t check that). So, your macro will see the condition is true and then go to the next step.

Thanks for this. I obviously misinterpreted the “button enabled” function. The macro doesn’t automatically progress while the Save dialog box is open anyway.

Can anyone suggest another way of moving on to the next step once the Save dialog has been closed?

Pause Until the front window title is or is not something may work. The Save sheet probably appears as the focussed window, and its window title is probably different to the parent window title, and it should be possible to detect that difference.

To figure out the window titles, create an action “Set Variable to Text %WindowName%1%”, and leave the action visible on the screen. Keyboard Maestro will show you the name of the front window. Change to wherever your macro is running, note the window title, invoke the Save dialog, note the window title. If they change, then you’re golden.

Hi Peter,

Many thanks for your suggestion. With the Save dialog open, the front window doesn't appear to have a name. (see attached screenshots with and without Save dialog open.)

I've tried setting Pause until conditions met to a number of different possibilities, e.g. "Pause until the variable: %WindowName%1%" doesn't exist / is empty / matches [nothing] / etc. I've tried them with is true/not true. I've also tried these options on "The front window of Mail" but the condition doesn't appear to change (in KM) whether the Save dialog is open or not.

Any ideas?

Use Pause Until the front window title is "" or is not "" (no quotes, just leave the field empty).

Hi Peter,

Fantastic. The macro now works a treat!

The finer differences between Front Application title is “” and title does not contain “” are beyond me so many thanks for your help. Your support here is simply second to none. Long may it last – we are all indebted to you.

Best regards,

Steve

As a general rule in Keyboard Maestro:

  • is means “equals”, ie exactly the same. Usually case is irrelevant. So “Hello” is “hello”.
  • contains means the search text appears somewhere within the searched item. Usually case is irrelevant. So “Hello” contains “hel”.
  • matches means the searched item is matched by the regular expression. Usually case is relevant, unless there is an option for this, although you can use regular expression flags to adjust it in any event. So “Hello” is matched by “e.*o”.