[Guide] Setup highlight copy middlemouse button paste (X-11)

Having just re-installed Windows 8.1 on my work laptop over Crunchbang Linux (Debian) I found no longer being able to use copy highlight pasting a bit of a nuisance so here’s how to achieve similar functionality on Windows.

 

Step1) Install AutoHotKey (AHK) Link: http://ahkscript.org/download/
Step 2) Load the following script into an ahk file in the directory you told AutoHotKey to load scripts from:

cos_mousedrag_treshold := 20 ; pixels

#IfWinNotActive ahk_class ConsoleWindowClass

~lButton::
MouseGetPos, cos_mousedrag_x, cos_mousedrag_y
keywait lbutton
mousegetpos, cos_mousedrag_x2, cos_mousedrag_y2
if (abs(cos_mousedrag_x2 – cos_mousedrag_x) > cos_mousedrag_treshold
or abs(cos_mousedrag_y2 – cos_mousedrag_y) > cos_mousedrag_treshold)
{
wingetclass cos_class, A
if (cos_class == “Emacs”)
sendinput !w
else
sendinput ^c
}
return

~mbutton::
WinGetClass cos_class, A
if (cos_class == “Emacs”)
SendInput ^y
else
SendInput ^v
return

#IfWinNotActive

;; clipx
^mbutton::
sendinput ^+{insert}
return

Save and close, Magic! Copy on Highlight now works.

About Robert Craig