Hello, in the action below, I want to cancel the macro if I press escape, otherwise continue, but logically I have to query the user beforehand.
I could not find any query action.
How would create an action which would:
In the default config (as shown above) it cancels the macro if you press Escape. (It continues if you press Return.)
If your macro has any kind of repeat loop, you could simply build a condition into the loop, like the one you have shown in your post, or an Assertion action with the appropriate key condition. When Escape is down, the macro will be canceled, otherwise the loop continues.
Is it necessary to have a specific continue key, if you already have a specific cancel key? (This is also contradicting what you said at the beginning of your post: “otherwise continue”.)
thank you for taking the time to reply.
I don't understand: in your macro, where is the prompt, ie ask user to press escape to cancel or 4 to continue.
You didn't ask for a "prompt" in your original question. All you said is "continue if press $" and my code does that. I had no idea you wanted a prompt. All you said was if the user presses "$" to continue.
You are right and I am sorry for not being clear.
Thank you for the macro.
Once I started writing the action, I realized that at some point, the user has to be prompted for a keypress.
thanks again
Most people who ask questions are asking very specific questions, resulting in perhaps not the best answer possible. I'm going to take a guess that what you really want is a way for a macro to know if a user is "ready" for the next step. Here are a couple of different ways I go about that.
The first action waits until the user has done nothing for 60 seconds. I find this a good way for my macro to know if the user is "ready" (ie, not busy). Therefore no keystroke is required, instead the absence of keystroke and mouse movements trigger the macro to continue:
Another way with a slightly different effect is to insert the following statement from time to time inside my macros: (essentially the CAPS LOCK key becomes the equivalent of a PAUSE key).
I have a few other more complex macros that do something similar. For example I once made a macro that said "if the user's iPhone is within Wifi range of this computer then...". I also had one that allowed the user to speak to the computer to activate a macro or change a condition for macros to evaluate. I don't think you need those macros, but consider the ideas to be food for thought.
There is a slight bug in the CAPS LOCK pause statements above. They don't actually pause while the CAPS LOCK button is in the CAPS LOCK STATE, they only pause when the button is physically pressed.
I never noticed that because in my case I was only using it in such a way that I had to turn it ON briefly to continue my program. So for me it worked fine this way.
But I think it should work differently. It should work by determining the CAPS LOCK STATE not the physical position of the CAPS LOCK KEY. This may be exactly how KM intended to behave, but I feel that it would be far more sensible to behave based on the STATE.
So I put my mind to it (mostly by googling) and I think I solved how to detect if the state of macOS in in CAPS LOCK, as opposed to whether the key is down. I create a variable called CapsLockState and add this one macro to my system: