Hello, this script cycles through buttons F1-3 in a loop by pressing the key 'a' over and over. What I want to alter about this is also have it send a '0' keypress every time as well, how can I do that?
a::
key++ ; this will help cycling through the keys depending on its value
if key = 1
Send, {F1}
else if key = 2
Send, {F2}
else if key = 3
{
Send, {F3}
key = 0 ; return to the original state... do this on the last hotkey you would like to send
}
return
Cycling through keypresses with one button Topic is solved
Re: Cycling through keypresses with one button
Just add Send, 0 right above key++.
Edit: You can also simplify the original code a bit. Here is an example that does everything you want:
If you want it to send a 0 after pressing F1/F2/F3, move Send, 0 down to just above return.
Edit: You can also simplify the original code a bit. Here is an example that does everything you want:
Code: Select all
a::
Send, 0
key++
Send {F%key%}
if key = 3
key = 0
return
Last edited by MaxAstro on 29 Mar 2017, 09:27, edited 1 time in total.
-
- Posts: 302
- Joined: 05 Feb 2017, 00:03
Re: Cycling through keypresses with one button
You can try just putting a 0 either before or after the F key, depending on when you want it sent, like so:
OR
MaxAstro's code above looks like the best suggestion.
Code: Select all
Send, {F1}0
Code: Select all
Send, 0{F1}
MaxAstro's code above looks like the best suggestion.