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

Trying to make my middle mouse button to function as 3 different keys based on the elapsed time it 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:

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

and I have tried to modify some of it

MButton: :    keyDown := A_TickCount    While GetKeyState("MButton", "P")    Send {^C}    duration := A _TickCount - keyDown    Send {Ctrl Up}    if duration < 299        Send {MButton}    if duration < 500        Send {^C}    if duration < 1000        Send {^V}    Return

Viewing all articles
Browse latest Browse all 8937

Trending Articles