piusare/mausuHoldo.ahk
2023-05-18 22:53:43 +02:00

280 lines
No EOL
3.5 KiB
AutoHotkey

#MaxThreadsPerHotkey 2
#HotkeyInterval 10000
#MaxHotkeysPerInterval 9999
;;WINDOOOOOOOOOOOOOOOOOOOOOOOOOOOOOWS y ahk unaware del futuro de los escritorios
;;https://www.autohotkey.com/boards/viewtopic.php?t=97706
DllCall("SetThreadDpiAwarenessContext", "ptr", -3, "ptr")
;;DllCall("QueryPerformanceCounter", "Int64*", baseTime)
;;DllCall("QueryPerformanceCounter", "Int64*", currentTime)
;;DllCall("QueryPerformanceFrequency", "Int64*", updateRate)
;;updateRate := updateRate / 1000
;;currentTime := currentTime / 1.0
;;baseTime := baseTime / 1.0
mouseActive := 0
rightMov := 0
lefMov := 0
upMov := 0
downMov := 0
rBtnHold := 0
mBtnHold := 0
lBtnHold := 0
speedUp := 1
speedUpFactor := 20
mouseSpeed := speedUp * speedUpFactor + 3
;;Toggle speed
RCtrl & ,::
;;SendInput, {RCtrl Up}
speedUp := !(speedUp)
mouseSpeed := speedUp * speedUpFactor + 3
;;SendInput, {RCtrl Down}
return
;;tuckaway
;;targeting 1080p displays with taskbar on top. Change at your leisure.
RCtrl & .::
MouseMove, 1940, 100
;;inputCleaning()
return
mouseMovement(lefMov, rightMov, upMov, downMov, mouseSpeed)
{
MouseMove, (rightMov + lefMov) * (mouseSpeed), (upMov + downMov) * (mouseSpeed), 0, R
}
LAlt & RAlt::
RAlt & LAlt::
;;<^>!LAlt::
;;LAlt & RAlt::
mouseActive := !(mouseActive)
#if mouseActive
Loop
{
if (mouseActive == 0)
{
lefMov := 0
rightMov := 0
upMov := 0
downMov := 0
lBtnHold := 0
mBtnHold := 0
rBtnHold := 0
break
}
;;DllCall("QueryPerformanceCounter", "Int64*", currentTime)
;;if (currentTime - baseTime >= updateRate)
;;{
mouseMovement(lefMov, rightMov, upMov, downMov, mouseSpeed)
baseTime := currentTime
;;}
}
return
#if
return
$j::
if (mouseActive == 1)
{
lefMov := -1
}
else
{
SendInput, j
}
return
j Up::
if (mouseActive == 1)
{
lefMov := 0
}
return
$sc027::
if (mouseActive == 1)
{
rightMov := 1
}
else
{
SendInput, {sc027}
}
return
sc027 Up::
if (mouseActive == 1)
{
rightMov := 0
}
return
$l::
if (mouseActive == 1)
{
upMov := -1
}
else
{
SendInput, l
}
return
l Up::
if (mouseActive == 1)
{
upMov := 0
}
return
$k::
if (mouseActive == 1)
{
downMov := 1
}
else
{
SendInput, k
}
return
k Up::
if (mouseActive == 1)
{
downMov := 0
}
return
$u::
if (mouseActive == 1)
{
if(lBtnHold == 1)
{
SendInput, {LButton Up}
lBtnHold := 0
}
else
{
SendInput, {LButton}
}
KeyWait, u
}
else
{
SendInput, u
}
return
u Up::return
$m::
if (mouseActive == 1)
{
if(lBtnHold == 1)
{
SendInput, {LButton Up}
lBtnHold := 0
}
else
{
SendInput, {LButton Down}
lBtnHold := 1
}
KeyWait, m
}
else
{
SendInput, m
}
return
m Up::return
$i::
if (mouseActive == 1)
{
if(mBtnHold == 1)
{
SendInput, {MButton Up}
mBtnHold := 0
}
else
{
SendInput, {MButton}
}
KeyWait, i
}
else
{
SendInput, i
}
return
i Up::return
$sc033::
if (mouseActive == 1)
{
if(mBtnHold == 1)
{
SendInput, {MButton Up}
mBtnHold := 0
}
else
{
SendInput, {MButton Down}
mBtnHold := 1
}
KeyWait, `,
}
else
{
SendInput, `,
}
return
sc033 Up::return
$o::
if (mouseActive == 1)
{
if(RBtnHold == 1)
{
SendInput, {RButton Up}
mBtnHold := 0
}
else
{
SendInput, {RButton}
}
KeyWait, o
}
else
{
SendInput, o
}
return
o Up::return
$.::
if (mouseActive == 1)
{
if(rBtnHold == 1)
{
SendInput, {RButton Up}
mBtnHold := 0
}
else
{
SendInput, {RButton Down}
mBtnHold := 1
}
KeyWait, `.
}
else
{
SendInput, `.
}
return
;;#if
return