Skip to content

Instantly share code, notes, and snippets.

@budRich
Created July 20, 2013 10:45
Show Gist options
  • Save budRich/6044613 to your computer and use it in GitHub Desktop.
Save budRich/6044613 to your computer and use it in GitHub Desktop.
/*
MaoSir - AutoHotmouse
---------------------
Just a bunch of hotkeys for the mouse.
It takes some time to get used to, but
after a while you can't live without them.
LButton combos are for windows.
(LButton & MButton = Close window)
RButton combos are for tabs.
(RButton & MButton = Close tab)
Copy link on web page, paste it in address bar:
select text, double right click to copy, select address,
backbutton (XButton1) to delete (Don't worry, you can still go
back with the button, Backspace is the keyboard shortcut for back (up)),
Tripple right click to paste, doubleclick mbutton (Enter) to go.
OBS! There are some (many) games that doesn't work properly with some
of these hotkeys, use Win+T to toggle them On/Off.
-----------------------
Scripted by: budRich
Updated: 2013-09-28
*/
#T::Suspend, Toggle
XButton1::BackSpace
~LButton & WheelUp::AltTab
~LButton & WheelDown::ShiftAltTab
~LButton & MButton::WinClose, A
~LButton & RButton::WinMinimize, A
RButton & WheelUp::Send,^{PGDN}
RButton & WheelDown::Send,^{PGUP}
RButton & MButton::Send,^w
RButton & LButton::Send, {F5}
RButton & XButton2::Send, ^x
Rbutton::
keywait, rbutton, d, t0.1
if errorlevel = 0
{
sleep, 200
keywait, rbutton, d, t0.1
if (errorlevel = 0) {
sleep, 200
keywait, rbutton, d, t0.1
if (errorlevel = 0)
QudraRight()
else
TrippleRight()
}
else
DoubleRight()
Return
}
else
mouseclick, right
return
Mbutton::
keywait, Mbutton, t0.3
if errorlevel = 1
return
else
keywait, Mbutton, d, t0.3
if errorlevel = 0
{
DoubleScroll()
Return
}
else
keywait, Lbutton, d, t0.6
; Mbutton & Lbutton = Move Window
if errorlevel = 0
{
CoordMode, Mouse ; Switch to screen/absolute coordinates.
MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin
WinGetPos, EWD_OriginalPosX, EWD_OriginalPosY,,, ahk_id %EWD_MouseWin%
WinGet, EWD_WinState, MinMax, ahk_id %EWD_MouseWin%
if EWD_WinState = 0 ; Only if the window isn't maximized
SetTimer, EWD_WatchMouse, 10 ; Track the mouse as the user drags it.
return
}
else
mouseclick, m
return
EWD_WatchMouse:
GetKeyState, EWD_LButtonState, LButton, P
if EWD_LButtonState = U ; Button has been released, so drag is complete.
{
SetTimer, EWD_WatchMouse, off
return
}
GetKeyState, EWD_EscapeState, Escape, P
if EWD_EscapeState = D ; Escape has been pressed, so drag is cancelled.
{
SetTimer, EWD_WatchMouse, off
WinMove, ahk_id %EWD_MouseWin%,, %EWD_OriginalPosX%, %EWD_OriginalPosY%
return
}
; Otherwise, reposition the window to match the change in mouse coordinates
; caused by the user having dragged the mouse:
CoordMode, Mouse
MouseGetPos, EWD_MouseX, EWD_MouseY
WinGetPos, EWD_WinX, EWD_WinY,,, ahk_id %EWD_MouseWin%
SetWinDelay, -1 ; Makes the below move faster/smoother.
WinMove, ahk_id %EWD_MouseWin%,, EWD_WinX + EWD_MouseX - EWD_MouseStartX, EWD_WinY + EWD_MouseY - EWD_MouseStartY
EWD_MouseStartX := EWD_MouseX ; Update for the next timer-call to this subroutine.
EWD_MouseStartY := EWD_MouseY
return
DoubleRight() {
Send, ^c
}
TrippleRight() {
Send, ^v
Sleep, 400
}
QudraRight() {
Send, ^+v
sleep, 400
}
DoubleScroll() {
Send, {Enter}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment