I'm Trying to Get a Keystroke to Not Go Through After Some Time

Hello, I have the following macro which does Shift+J when I click the button for under 0.2 seconds and Control+Shift+J for over that amount.

Screen Shot 2022-01-09 at 1.59.41 PM (2)

The problem I'm having is that if I hold down the button for lets say 3 seconds, when I release (due to the macro reacting when the button is released per the attachment), it does the Shift+J keystroke again which is what I'm trying to avoid. How can I have it do the Shift+J within those 0.2 seconds and not repeat it when I release after that time or a second or two? Thank you!

This thread

will give you some pointers for how to do it.

(There are other examples in the forum - just do a search for long press)

Thanks! I will look into it. I'm wondering if it will create a conflict with the fact that I already have a command going after a specific amount of time. I will update the thread when I make some progress.

This may be over my pay grade. I've been trying to figure it out by downloading the macro and playing around with it but no luck so far. All I want is after I hold down the button, when I release it to not have it trigger the keystroke. I was hoping there would be a more straightforward answer.

I've actually managed to make some progress but it only works with a keyboard key. I need it to work with a mouse button (USB Device Key) and so far I don't even know if that's possible.

I get it to work with a button on my Intuos Pro tablet which is a USB Device Key trigger.

Can you be more specific about what it is? Which macro are you using - post it up here.

Thanks for going through this with me. On the macro I attached on the OP, you can see that I have my Razer Naga mouse button #6 being used as the trigger. The issue is that the trigger works when the button is released which means that despite having two different commands depending on the time, if I hold it down for a second for example upon release it executes the Shit+J command again which is what I'm trying to avoid.

Through your link I downloaded the one shown here Macro Trigger Option Using Long Press of Hot Key [Example]

Where I'm having the issue is the part that says "If any of the following is true: THE KEY is down". I'm supposed to match that key with the trigger up top but given I use my mouse button, there is no option for a USB device Key in that window.

Yes, that’s a problem. I’m not sure how to get around that.

How are you using it with your USB Device Key?

I use a Magic Trackpad so no mouse buttons from me. I didn’t study your OP well enough to spot you were talking about a mouse button but I knew other threads existed that covered long-presses which is why I pointed in that direction.

That’s all I’ve got, sorry. Maybe someone else has done something similar with mouse buttons?

Gotcha. Let me see if Peter can help.

@peternlewis could you pitch in on this and let me know if there is a way to do it?

You need two macros.

One that happens when the button is pressed and simply sets the time variable used (in this case, you have used variable “This Key Pressed Time”). Set is to the calculation “SECONDS()”.

Then your second macro is when it is released as shown above.

Without the first macro, the variable “This Key Pressed Time” will never be set.

1 Like

Yes I already have that Peter. I didn't include it in the thread because is not related to my issue. As I mentioned above what I'm trying to do is upon releasing the trigger over a second or two to not execute the action Shift+J.

Hey @syra,

Have you tried Trigger is “Pressed” not “Down”?

-Chris

1 Like

As @ccstone notes, your macro is triggered while the key is down. It needs to trigger only when the key is pressed.

As it is, the first macro is triggered when you press the key, and then repeatedly while you hold it down, resetting the time each time, so that when it is released and the second macro fires, only a small amount of time has passed since the first macro has triggered.

Thank you @ccstone and @peternlewis! The key "Pressed" instead of "Down" worked!! The first action doesn't trigger anymore when I release after holding it down for a little longer. The only problem now is that when I release after holding down for a second or two the Shift+Control+J secondary action gets triggered. Is there a way to have the first action activate under 0.2 seconds and the second action over that amount (per the existing macro) BUT only up to a second for example. So if I hold it down for longer than the maximum set time, it won't trigger.

Never mind I figured it out! I'm attaching the Macro below in case anyone finds it useful. Thanks again so much for all the help guys!! I keep saying it but this forum is the best!

Screen Shot 2022-01-13 at 4.36.17 PM (2)

3 Likes