The Corsair User Forums

The Corsair User Forums (https://forum.corsair.com/forums/index.php)
-   iCUE Software (https://forum.corsair.com/forums/forumdisplay.php?f=280)
-   -   Macro to tap or hold for same key (https://forum.corsair.com/forums/showthread.php?t=186722)

KingKielbasa 04-07-2019 06:25 PM

Macro to tap or hold for same key
 
I have a K70 Mk2 keyboard. I currently Have the lock button at the top left of the keyboard macro'd to open my VPN service, which auto connects when opened. I would also like to use the same key to run a .bat file that kills VPN process. How do i configure the lock button when held for 3 seconds to run the .bat file? And i want it to not do what it normally does when i press the key for less than 3 seconds (open the VPN again, when i want to close it). i hope that all makes sense.

thanks!

hastegag 04-07-2019 07:54 PM

for the macro keys, which i dont think your model has, you can use the SDK to do this, but there's no held length of time control I am aware of ... in some part because you could end up switching profiles during the held keypress.

If you would like Autohotkey to do this, there are a couple ways to achieve it, but they would require iCUE to remap the lock key to emit some other keypress.

The better option inside icue is for say a modifier key to temporarily switch profiles (say ctrl?) and then the lock button in your ctrl profile can just to the action to kill the VPN process.

If you do not have the physical ability to press both keys or would rather know how to avoid that, or avoid using cue to switch profiles first, then AHK can definitely fill in there. If you set iCUE to remap the lock button to a key that isnt one on your keyboard, like F13, then you can have Auothotkey sniff for F13:: as a hotkey and either use a toggle or a held timer with something like:

Code:

F13::
    if (A_TimeSincePriorHotkey < 500 && (A_PriorHotkey = A_ThisHotkey))
    {
        vpnClose() ;you need to write this
    }
else {
    vpnOpenIfNotOpen() ; you also need to write this
}
return


Danny van Liero 04-08-2019 07:45 AM

Do you really need the 3 seconds? :)
An other option can be to run some script when you press the key, this is possible
and let this script handle 2 states,
do if VPN == off
and do if VPN == on

Keeping the state in some other file, or you can check it by a ping to your VPN.

I dont see any other solution with iCue.

hastegag 04-08-2019 10:34 AM

Quote:

Originally Posted by Danny van Liero (Post 1000748)
and let this script handle 2 states

Genius! that is better

Danny van Liero 04-08-2019 10:37 AM

Nice! Hopes it works out for you! And thank you for the feedback! :)


All times are GMT -4. The time now is 12:17 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.