Topic starter thought is necessary to remove the content of his posts.
For reference, his initial script kept looping its output even after releasing the triggering key and some posts were:
Sorry guys! I don't know what to do. This script keeps getting stuck on an infinite loop and I really can't fix this.
Sometimes it gets stuck in the loop after I release the key and continuously sends the hotkeys until I press the key 1 again or reload the script.
Please, I need some help.
Code: Select all
#Persistent
#SingleInstance force
#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#InstallKeybdHook
#KeyHistory 0
ListLines Off
Process, Priority, , H
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, -1
SendMode Input
$1::
While, GetKeyState("1", "P"){
SendInput {7 Down}{8 Down}{9 Down}
DllCall("Sleep","UInt",4)
SendInput {7 Up}{8 Up}{9 Up}
DllCall("Sleep","UInt",4)
}
return
@Helgef
Thank you so much for your time trying to help me. I really appreciate your help. But even using loop 1, it's very slow compared to what I'm using.
I tried this:
Code: Select all
for k, key in keys
sendinput % "{" key " down}"
dllcall("Sleep", "uint", duration)
for k, key in keys
sendinput % "{" key " up}"
}
}
Numpad3::
Reload
return
$*Ins::Suspend
Code: Select all
#Persistent
#SingleInstance force
#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#InstallKeybdHook
#KeyHistory 0
ListLines Off
Process, Priority, , H
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, -1
SendMode Input
$1::
if GetKeyState("ScrollLock", "T"){
While, GetKeyState("1", "P"){
SendInput 789
DllCall("Sleep","UInt",5)
}
}
return
Numpad3::
Reload
return
$*Ins::Suspend
Anyway, thank you very much!
Nextron, I guess that you found the problem man!
I'm testing this:
Code: Select all
SetKeyDelay, -1, -1
ListLines Off
Process, Priority, , H
$1::
if GetKeyState("ScrollLock", "T"){
While, GetKeyState("1", "P"){
SendInput 789
DllCall("Sleep","UInt",2)
}
}
return