How Do I Launch an Application and Pause Until It Can Accept Input?

As a side note, it took me a while to find "Activate" for an application. I'm use to the terms open or launch.

My question is: I activate Quicken and then I put Pause until Quicken is at the Front and then the next action was a Type :arrow_up: %R Keystroke but my Mac would beep and Quicken would not get the keystroke. So I added a Pause for 3 seconds. This work but, obviously will be fragile. Is there are better way to do this?

You could try the Pause Until action with the Menu condition set appropriately - see condition:Menu [Keyboard Maestro Wiki] to wait until the desired Quicken menu option becomes available.

2 Likes

I wasn’t addressing the exact same issue, but the short macro I posted here has some information I’ve learned when waiting. See the comment within.

2 Likes

Hey Perry,

  1. Pause Until Application is frontmost.
  2. Pause Until Menu-Path Condition.

See @tiffle's suggested Wiki reading.

“or you can look for a specific menu based on its path.”

Pay close attention to the PATH condition.

It is significantly faster than the plain menu condition.

-Chris

2 Likes

That is worth knowing. I suppose it must be because Keyboard Maestro doesn't have to search for the menu item in every single menu until it finds the menu item.

1 Like

I just discovered this a few weeks ago from somebody's comment here, and went through all of my macros that had this feature (around 115) to change them to path... and it really did make a noticeable difference.

1 Like

@pedz, @ccstone, I've had a few cases when a macro would sporadically fail (i.e., move on too quickly) unless a third condition was added.

The text:
%WindowName%1%
is not empty

@ccstone, thanks for the reminder. Here's an updated example that uses the suggested with path specification.


Finder ➤ Show View Options Macro (v10.0.2)

DOWNLOAD Macro File:
Finder ➤ Show View Options.kmmacros (17 KB)
Note: This macro was uploaded in a DISABLED state. It must be ENABLED before it can be run. If it does not trigger, the macro group might also need to be ENABLED.

Macro-image

1 Like

Thank you to all who have replied.

I am making progress but I feel like I need to document some of my observations. The most bizarre is via Quicken. I hope I can generate a good test case. But the script is going through a sequence of dialog boxes and then it has a button in a dialog box "Choose CSV File to Import...". The action I had was to push the button and it successfully pushed the button because the open dialog box comes open but then the action would stall and time out because it said there was no button. To rephrase (because it is hard to believe) the action found and pushed the button but then stalled and timed out because there was no button.

I've also had trouble finding Menu items. Maybe there is some hidden text or something some times. I will try to find and document one of those cases too. I think that was with Numbers which others are more likely to have.

Here's some information that you might find helpful: action:Select or Show a Menu Item [Keyboard Maestro Wiki]

In particular, since regular expressions are supported, you might be able to find the menu items in question. For example, in the example I provided, rather than entering Menu Item: Show View Options one could enter: ^Show View

1 Like

Try using pause-until button exists.

Try using the menu-selector-menu when creating the menu action.

Select or Show a Menu Item action

-Chris

Thank you all again. I am surprised at how slow my learning curve is. I'm just not really paying attention.

Is there a way to lock a macro so I can't accidentally change it?

Also, is there a way so that the default timeout is something within my lifetime instead of 99 hours? e.g. 2 seconds is what I'm picking at first and then adjusting if necessary.

No worries, we all start somewhere!

Not an individual macro, no. You can select Stop Editing Macros from the View menu but that applies to all macros. What I do when I don't want to inadvertently mess up a macro is collapse all of it's actions, and then group them all together and collapse that group, giving it a custom title like "don't screw around with this because it already works great and if you change something you're just going to break it and then you'll be kicking yourself the rest of the day" :laughing:

Not that I'm aware of (although some hidden preferences can be adjusted via Terminal, I'm just not sure if this is one of them). But you can adjust the timeout on an action, and then add it to your favorites via the native favorites feature of KM10 or via @DanThomas KMFAM Favorites macro.