Code: Select all
1 & 9::
So my question is, is it possible to make so that if they are pressed within a certain timeframe of each other (say half a second), it will trigger the thread anyway?
Code: Select all
1 & 9::
I understand but doing it either way doesn't do anything to solve my issue. The issue is that sometimes, while I'm pressing a lot of other keys, I'll accidentally release 1 before I press 9 and miss out on triggering my thread. Basically, I want to trigger my thread even if I make a slight mistake (as long as the mistake is slight). So I'd like to trigger my thread as long as I press 1 and 9 within .5-1 second of each other, for example.Osprey wrote:You shouldn't be trying to press them down at the same time. You should be pressing and holding the 1 key first and then pressing the 9 key second, like how you hold shift down and then press keys that you want to capitalize.
In that case, it sounds like you need hotkeys for 1 and 9 separately, like this:Crushthebug wrote:I understand but doing it either way doesn't do anything to solve my issue. The issue is that sometimes, while I'm pressing a lot of other keys, I'll accidentally release 1 before I press 9 and miss out on triggering my thread. Basically, I want to trigger my thread even if I make a slight mistake (as long as the mistake is slight). So I'd like to trigger my thread as long as I press 1 and 9 within .5-1 second of each other, for example.
Code: Select all
~1::
If (A_PriorHotkey = "~9") and (A_TimeSincePriorHotkey < 1000)
Goto, MySubroutine
Return
~9::
If (A_PriorHotkey = "~1") and (A_TimeSincePriorHotkey < 1000)
Goto, MySubroutine
Return
MySubroutine:
; Code that you originally triggered with "1 & 9"
Return
That's actually genius and works perfectly, thanks a ton. I have one other problem not exactly related to this but related to the same script that I'm setting up. Would you mind giving it a look?Osprey wrote:In that case, it sounds like you need hotkeys for 1 and 9 separately, like this:Crushthebug wrote:I understand but doing it either way doesn't do anything to solve my issue. The issue is that sometimes, while I'm pressing a lot of other keys, I'll accidentally release 1 before I press 9 and miss out on triggering my thread. Basically, I want to trigger my thread even if I make a slight mistake (as long as the mistake is slight). So I'd like to trigger my thread as long as I press 1 and 9 within .5-1 second of each other, for example.
Code: Select all
~1:: If (A_PriorHotkey = "~9") and (A_TimeSincePriorHotkey < 1000) Goto, MySubroutine Return ~9:: If (A_PriorHotkey = "~1") and (A_TimeSincePriorHotkey < 1000) Goto, MySubroutine Return MySubroutine: ; Code that you originally triggered with "1 & 9" Return
Code: Select all
#MaxThreadsPerHotkey 2
~1::
If (A_PriorHotkey = "Space") and (A_TimeSincePriorHotkey < 20)
Goto, MySubroutine
Return
~9::
If (A_PriorHotkey = "Space") and (A_TimeSincePriorHotkey < 20)
Goto, MySubroutine2
Return
Space::
If (A_PriorHotkey = "~1") and (A_TimeSincePriorHotkey < 800)
Goto, MySubroutine
If (A_PriorHotkey = "~9") and (A_TimeSincePriorHotkey < 800)
Goto, MySubroutine2
Return
MySubroutine:
toggle := !toggle
Loop
{
; a bunch of "Send events", "Sleeps" and "if (!toggle) breaks"
Toggle := false
}
until !toggle || (a_index = 1)
Return
Code: Select all
#MaxThreadsPerHotkey 2
~1::
If (A_PriorHotkey = "Space") and (A_TimeSincePriorHotkey < 20)
Goto, MySubroutine
Return
~9::
If (A_PriorHotkey = "Space") and (A_TimeSincePriorHotkey < 20)
Goto, MySubroutine
Return
Space::
If (A_PriorHotkey = "~1") and (A_TimeSincePriorHotkey < 800)
Goto, MySubroutine
Else If (A_PriorHotkey = "~9") and (A_TimeSincePriorHotkey < 800)
Goto, MySubroutine
Else toggle := false
Return
MySubroutine:
toggle := true
Loop
{
; a bunch of "Send events", "Sleeps" and "if (!toggle) breaks"
} Until !toggle
Return
Osprey wrote:Try this:
Code: Select all
#MaxThreadsPerHotkey 2 ~1:: If (A_PriorHotkey = "Space") and (A_TimeSincePriorHotkey < 20) Goto, MySubroutine Return ~9:: If (A_PriorHotkey = "Space") and (A_TimeSincePriorHotkey < 20) Goto, MySubroutine Return Space:: If (A_PriorHotkey = "~1") and (A_TimeSincePriorHotkey < 800) Goto, MySubroutine Else If (A_PriorHotkey = "~9") and (A_TimeSincePriorHotkey < 800) Goto, MySubroutine Else toggle := false Return MySubroutine: toggle := true Loop { ; a bunch of "Send events", "Sleeps" and "if (!toggle) breaks" } Until !toggle Return
Users browsing this forum: apeironn, madensuyu1, peter_ahk and 332 guests