Quantcast
Channel: Active questions tagged windows - Super User
Viewing all articles
Browse latest Browse all 9162

trying to make ctrl key to function as 3 different keys based on the elapsed time ctrl has been pressed

$
0
0

I'm using AHK and my main goal is to make my middle mouse button to function as it normally would if I pressed it once, but would trigger "Ctrl + C" or copy if I pressed and held it for 500ms and paste what is copied or "Ctrl + v" if I kept on pressing for 1000ms

I have searched the internet for a week but couldn't find a solution (maybe its because I'm new to this) but here's some codes I found that I believe would get it done but for some reason I couldn't get it to work.

Here's the code I found


The original codeand I have tried to modify some of it and here it is

Modified Code

I apologize for posting as image, as you can see below the indentation doesn't look clean

RCtrl::    keyDown := A_TickCountWhile GetKeyState("RCtrl", "P")        Send {Ctrl Down}    duration := A_TickCount - keyDown    Send {Ctrl Up}    if duration < 300        Send {Enter}    Return 

Viewing all articles
Browse latest Browse all 9162

Trending Articles