Monday, February 17, 2014

New mouse

I recently switched from a Logitech wireless mouse with a whole bunch of buttons to a much simpler, corded mouse with only left-click, right-click, and a clickable scroll wheel. Having to change and rotate batteries got to be extremely annoying, and when the battery cover broke off, it was time for a change.

I knew I needed to be creative with AutoHotkey to match the functionality of my last mouse, and the additions I came up with made this three-button mouse even better. Which is what I want; if I got too used to the other mouse with more buttons, replacements would be price.

Here are the scripts (comment tags in yellow):

SetTitleMatchMode, 2
#IfWinNotActive, Google Chrome
MButton::Click 2
#IfWinNotActive
return
;a true, real double-click
;double-clicks with middle button (scroll button) everywhere EXCEPT Google Chrome
;I want to be able to open new tabs without going to them in Google Chrome

~LButton & RButton::
Send {LButton}{enter}
return
;double-click in file browsers
;the ~ is so left-click still left-clicks
;note that it's my own "improved" version because Windows 7 annoyingly moves the thing you clicked on when viewing ;files in list move, which prevents double-clicking on items that are "a little bit out of the way" from actually executing, so it's really "click, then Enter"

~LButton & WheelDown::
If (A_TimeSincePriorHotkey>400)
send !{left}
return
;alt+left (go back a page in file & Internet browsers), but left button left-clicks as usual 
;the ~ is so left-click still left-clicks
;the >400 part is so I don't have to carefully hit only one notch

~LButton & WheelUp::
If (A_TimeSincePriorHotkey>400)
send !{right}
return
;alt+right (go forward a page in file & Internet browsers), but left button left-clicks as usual 
;the ~ is so left-click still left-clicks
;the >400 part is so I don't have to carefully hit only one notch

~LButton & MButton::
send !{up}
return
;alt+up (go up a directory in file browsers), but left button left-clicks as usual 
;the ~ is so left-click still left-clicks