Hi all!
Noob here and I am sorry if the answer to my question is somewhere in the forum but it's hard to find when I don't even know the keywords to describe what I want to do.
So I want to make a macro that when I use it one will send a sequence of commands that will be the same every time and a command that will be one of two alternatives.
For example when I press "1" once it will send: 1,2,3,x and when I press "1" a second time it will send: 1,2,3,y and then 3rd time 1,2,3,x and so on.
Is this possible?
Thanks!
Help a noob! Topic is solved
-
- Posts: 3
- Joined: 21 May 2020, 10:18
Re: Help a noob!
Yes it is possible. You will need a counter at the global scope to increment each time the hotkey is pressed and what to do inside the hotkey for each increment. Don't forget you will need to reset it back to 1 at the end of the last option.
- Yakshongas
- Posts: 590
- Joined: 21 Jan 2020, 08:41
Re: Help a noob!
Something like this:
Or:
Code: Select all
Num := True
$1::
Num :=!Num
If (Num = False)
{
SendInput, 1,2,3,x
}
Else if (Num = True)
{
SendInput, 1,2,3,y
}
Return
Code: Select all
Num = 0
$1::
Num++
If (Num = 1)
{
SendInput, 1,2,3,x
}
Else if (Num >= 2)
{
SendInput, 1,2,3,y
Num = 0
}
Return
Please mark your topics as solved if you don't need any further help.
Need a little more help? Discord : Yakshongas#9893 🕹
Need a little more help? Discord : Yakshongas#9893 🕹
-
- Posts: 3
- Joined: 21 May 2020, 10:18
Re: Help a noob! Topic is solved
Thanks a lot! Unfortunately this doesen work. It sends the first sequence, second hit of the button does nothing and then it sends the first sequence again.Yakshongas wrote: ↑21 May 2020, 11:02Something like this:
Or:Code: Select all
Num := True $1:: Num :=!Num If (Num = False) { SendInput, 1,2,3,x } Else if (Num = True) { SendInput, 1,2,3,y } Return
Code: Select all
Num = 0 $1:: Num++ If (Num = 1) { SendInput, 1,2,3,x } Else if (Num >= 2) { SendInput, 1,2,3,y Num = 0 } Return
-
- Posts: 3
- Joined: 21 May 2020, 10:18
Re: Help a noob!
Oh just saw the second one and it works like a charm! Thanks!
[Mod edit: selected 'completed' option on your behalf]
[Mod edit: selected 'completed' option on your behalf]
- flyingDman
- Posts: 2817
- Joined: 29 Sep 2013, 19:01
Re: Help a noob!
Simplify:
Code: Select all
$1::sendinput % (x := !x) ? "1,2,3,x" : "1,2,3,y"
14.3 & 1.3.7
Who is online
Users browsing this forum: blue_fields and 317 guests