Simulate Keystroke actions do not work on "Prompt for User Input"

ZZZZZZZZZZ Macro (v11.0.3)

ZZZZZZZZZZ.kmmacros (4.2 KB)

I have a test macro with Prompt for User Input action. I can manually interact with the prompt using the keyboard. I can manually press tab, tab, down arrow with the keyboard and the prompt for user input would respond.

But I cannot interact with the prompt using Simulate Keystroke actions. How come?

Thanks,
ChrisQ

You could do it, if you placed the pause and tab actions into a different macro. What you are currently thinking is that the "Prompt for User Input" action is asynchronous. It isn't asynchronous. That means it acts as a "Pause" until you press OK or Cancel. If you press Pause, it will continue with the actions below it. If you press Cancel, since the "Cancel Macro" is checked, it will stop running.

So you aren't actually prevented from doing what you want to do, as long as you do it in a second macro that's running concurrently (asynchronously) from the first macro. In fact, KM has a means for you to trigger a macro to run concurrently:

image

If you put this action before your Prompt for User action, and move the subsequent actions into a new macro that this action calls, it should work.

However I don't think your approach is probably the best approach. If you tell us why you are trying to do this, we might have a better solution for you.

2 Likes

Hi @Airy, thanks for the quick response and the clear explanation to the problem.

Prompt for User Input actually pauses for the user to input, thus the Simulate Keystroke actions are not executed at all. I should have realized that. :sweat_smile:

I was just trying to save a few user key presses. It's no big deal, I could live with it.

1 Like

@Airy's solution actually works really well. Just make a little Macro called something like "Default Choice" and put your keystrokes in that Macro. Invoke that Macro Asynchronously just before your Prompt.

Another approach would be to change the order of the Variables in the Prompt so that your preferred choice is the first one which is the one automatically selected.

Thanks @Zabobon, I just tried @Airy's solution and it works very well. :slight_smile:

However, when I tried the 2nd solution of putting the Date Type variable first, the Prompt for User Input popup does not auto select the first variable, "Date Type". I wanted to give this solution a try because it's a simpler solution that does not require another macro.

The input box will always get focus first; there's no setting you can use to change that (as far as I know; didn't mean to sound so definitive!), so a second macro would appear to be what you need to use.

-rob.

2 Likes