Jump to content
Corsair Community

Macro to tap or hold for same key


KingKielbasa

Recommended Posts

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!

Link to comment
Share on other sites

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:

 

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

×
×
  • Create New...