piusare/mausuHoldo.ahk

309 lines
5.2 KiB
AutoHotkey

;;eveentos down del teclado no paraban de joder porque paraban el unico hilo, so _h it was, its threading time
;;vaya puto apañazo de mierda, flipas
;;obs lo rompe wtf??????????????? y relive caputrar la pantalla basically
;;TODO ugly af no entrar en el mutex. bro q te pasa, habia prisa pero......
#MaxThreadsPerHotkey 2
#HotkeyInterval 10000
#MaxHotkeysPerInterval 9999
#NoEnv
#WarnContinuableException Off
#Persistent
;;Process, Priority, , R
;;DllCall("mouse_event", "UInt", 1, "UInt", (rightMov + lefMov) , "UInt", upMov + downMov )
;;WINDOOOOOOOOOOOOOOOOOOOOOOOOOOOOOWS y ahk unaware del futuro de los escritorios
;;https://www.autohotkey.com/boards/viewtopic.php?t=97706
DllCall("SetThreadDpiAwarenessContext", "ptr", -3, "ptr")
freqUpdater := DllCall("GetProcAddress", "Ptr" , DllCall("GetModuleHandle", "Str", "kernel32", "Ptr"), "AStr", "QueryPerformanceCounter", "Ptr")
;;VarSetCapacity(baseTime, 2334423432128)
;;VarSetCapacity(currentTime, 423523423128)
DllCall(freqUpdater, "Int64*" , baseTime)
DllCall(freqUpdater, "Int64*" , currentTime)
DllCall("QueryPerformanceFrequency", "Int64*", updateRate)
updateRate := updateRate / 1000
currentTime := currentTime ;;/ 1.0
baseTime := baseTime ;;/ 1.0
mouseActive := 0
rBtnHold := 0
mBtnHold := 0
lBtnHold := 0
speedUp := 1
speedUpFactor := 20
test1 := 0
test2 := 0
test3 := 0
test4 := 0
share:=CriticalObject({"lefMov" : 0,"rightMov" : 0,"downMov" : 0,"upMov" : 0,"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
;;TODO DAVBID Y EL ENTER
LAlt & RAlt::
RAlt & LAlt::
;;<^>!LAlt::
;;LAlt & RAlt::
mouseActive := !(mouseActive)
if (mouseActive == 1)
{
mouseThread := AhkThread("
(
#Persistent
Process, Priority, , H
DllCall(""SetThreadDpiAwarenessContext"", ""ptr"", -3, ""ptr"")
freqUpdater := DllCall(""GetProcAddress"", ""Ptr"" , DllCall(""GetModuleHandle"", ""Str"", ""kernel32"", ""Ptr""), ""AStr"", ""QueryPerformanceCounter"", ""Ptr"")
;;VarSetCapacity(baseTime, 2334423432128)
;;VarSetCapacity(currentTime, 423523423128)
DllCall(freqUpdater, ""Int64*"" , baseTime)
DllCall(freqUpdater, ""Int64*"" , currentTime)
DllCall(""QueryPerformanceFrequency"", ""Int64*"", updateRate)
ticksPerSecond := 10000
updateRate := Floor(updateRate / ticksPerSecond)
currentTime := currentTime ;;/ 1.0
baseTime := baseTime ;;/ 1.0
obj := CriticalObject(A_Args[1])
lefMov := obj.lefMov
rightMov := obj.rightMov
downMov := obj.downMov
upMov := obj.upMov
mouseSpeed := obj.mouseSpeed
delta := 0
Loop
{
DllCall(freqUpdater, ""Int64*"" , currentTime)
if (currentTime - baseTime >= updateRate) {
delta := (currentTime - baseTime) / ticksPerSecond
MouseMove, (obj.rightMov + obj.lefMov) * (delta), (obj.upMov + obj.downMov) * (delta), 0, R
;;DllCall(freqUpdater, ""Int64*"" , baseTime)
baseTime := currentTime
}
}
)", &share "")
}
else
{
mouseThread.ahkTerminate()
;;ahkthread_free(mouseThread)
share.lefMov := 0
test1 := 0
share.rightMov := 0
test2 := 0
share.upMov := 0
test3 := 0
share.downMov := 0
test4 := 0
lBtnHold := 0
mBtnHold := 0
rBtnHold := 0
;;break
}
return
#if mouseActive == 1
$j::
if (test1 == 0)
{
test1 := 1
share.lefMov := -1
}
return
j Up::
share.lefMov := 0
test1 := 0
return
$sc027::
if (test2 == 0)
{
test2 := 1
share.rightMov := 1
}
return
sc027 Up::
share.rightMov := 0
test2 := 0
return
$l::
if (test3 == 0)
{
test3 := 1
share.upMov := -1
}
return
l Up::
share.upMov := 0
test3 := 0
return
$k::
if (test4 == 0)
{
test4 := 1
share.downMov := 1
}
return
k Up::
share.downMov := 0
test4 := 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