How to block a key's native function for only part of the code
Posted: 24 Jan 2019, 14:21
Hello everyone. Here is my example for editing left mouse-clicking, it has two functions:
1. When un-toggled, LButton's function retained, pass all original left-clicks;
2. When toggled, LButton's function retained, unless LButton is held down for more than 1s (spam Space in this case).
However, I found in the case of spaming Space, it also spams LButton as well, which is what I want to block (to only spam Space).
So I wonder is there a specific command for blocking a key's native function, only for the spam Space part of the code?
Or should I do it in some other way? Any help would be appreciated.
1. When un-toggled, LButton's function retained, pass all original left-clicks;
2. When toggled, LButton's function retained, unless LButton is held down for more than 1s (spam Space in this case).
Code: Select all
~LButton::
If (!Toggle)
return ; Changes nothing when un-toggled
KeyWait LButton, T1 ; When toggled, wait 1s for releasing LButton
If ErrorLevel ; LButton still held down
While GetKeyState("LButton", "P"){ ; When LButton is held down
Send, {Space}
Sleep 100 ; Spam Space
}
return
So I wonder is there a specific command for blocking a key's native function, only for the spam Space part of the code?
Or should I do it in some other way? Any help would be appreciated.