I didn't even think about changing the
or to
&&. However, when I do that only the double-press section works. The single-press section no longer does. I thought I understood how the
if (A_PriorHotkey <> "~LShift" or A_TimeSincePriorHotkey > 350) portion of the code functioned. But after seeing your example, it seems clear to me why
or only allows the activation of the single-press section and
&& only works for the double-press section.
Your second example code does allow both sections to be activated, but not in the scenario that F6 was
A_PriorHotkey. Is it possible for both the single and double-press sections to function, even if
A_PriorHotkey is the trigger? For quick reference (really for myself as I know you already understand) here is what has been tried so far.
Always produces a Single-Press result, regardless of physical single/double-press activation
Code: Select all
F3::
if (A_PriorHotkey != "F3" or A_TimeSincePriorHotkey > 350)
{
; Too much time between presses, so this isn't a double-press.
MsgBox, "!=" and "or" / Single-Press Detected
return
}
MsgBox, "!=" and "or" / Double-Press Detected
return
Always produces a Single-Press result, regardless of physical single/double-press activation
Code: Select all
F4::
if (A_PriorHotkey != "F4" or A_TimeSincePriorHotkey > 350)
{
; Too much time between presses, so this isn't a double-press.
MsgBox, "=" and "or" / Single-Press Detected
return
}
MsgBox, "=" and "or" / Double-Press Detected
return
Always produces a Double-Press result, regardless of physical single/double-press activation
Code: Select all
F5::
if (A_PriorHotkey = "F5" && A_TimeSincePriorHotkey < 350)
{
; Too much time between presses, so this isn't a double-press.
MsgBox, "=" and "&&" / Single-Press Detected
return
}
MsgBox, "=" and "&&" / Double-Press Detected
return
If a different key is pressed before F6, it will always yield a Single-Press result. If F6 was pressed previously, it will always produce a Double-Press result. Results are true regardless of physical single/double-press activation
Code: Select all
F6::
if (A_PriorHotkey != "F6" && A_TimeSincePriorHotkey > 350)
{
; Too much time between presses, so this isn't a double-press.
MsgBox, "!=" and "&&" / Single-Press Detected
return
}
MsgBox, "!=" and "&&" / Double-Press Detected
return