Code: Select all
#NoEnv ; Recommended for performance and compatibility with future releases.
SendMode Input ; Recommended due to its superior speed and reliability.
GroupAdd, gw2, Guild Wars 2
GroupAdd, gw2, `.0 0 0
#IfWinActive ahk_group gw2
RButton::evaluateButton("RButton", "F1")
Wheelup::evaluateButton("Wheelup", "8")
Wheeldown::evaluateButton("Wheelup", "7")
evaluateButton(Button1, Button2, Button3)
{
if (isMouseShown()) {
send {%Button1% Down}
KeyWait, RButton
send {%Button1% Up}
} else {
send {%Button2% Down}
KeyWait, Wheelup
send {%Button2% Up}
} else {
send {%Button3% Down}
KeyWait, Wheeldown
send {%Button3% Up}
}
}
isMouseShown()
{
StructSize := A_PtrSize + 16
VarSetCapacity(InfoStruct, StructSize)
NumPut(StructSize, InfoStruct)
DllCall("GetCursorInfo", UInt, &InfoStruct)
Result := NumGet(InfoStruct, 8)
return (Result != 0)
}
Pause::ExitApp