Page 1 of 1

Really simple stuff - Diffrent outcomes of pressing one button second time

Posted: 19 Jul 2019, 21:29
by Wontyd
Hi, Fellow Internet stranger
I need help with simple command
when i press key X I want to press key A

x::
Send, a
return

I think... pretty simple right? well heres the part that is prob simple but i cant find it or logically do it myself
when i press key X I want to press key A
but when i press key X again, i want to make it press key B
3rd time key C
4th time key D
5th time key E
and reset for key A
so on...

btw, I dont mean double click, tripple etc...
Can someone possibly help me? ty
was using some macro editor of my mouse when i needed macros in the past, but i dont think this task can be done in "oscar editor" if you think you can do it in this simple enviroment then prove me wrong, i am looking forward to it ;)

Re: Really simple stuff - Diffrent outcomes of pressing one button second time

Posted: 19 Jul 2019, 23:00
by scriptor2016

Code: Select all

z::			 

count++   	 	 
If (count=1)
{
msgbox, 1
}

If (count=2)
{
msgbox, 2
}

If (count=3)
{
msgbox, 3
}

If (count=4)
{
msgbox, 4
Count=0
}
Return

Re: Really simple stuff - Diffrent outcomes of pressing one button second time

Posted: 20 Jul 2019, 03:54
by Odlanir
In a shorter form:

Code: Select all

cnt := 0, chars := StrSplit("ABCDE") ; if you change the chars the script will cycle for all the char listed
x::			 
   send, % chars[mod(cnt++,chars.MaxIndex())+1] 
Return
or

Code: Select all

send, % cnt++ >= chars.MaxIndex() ? chars[cnt:=1] : chars[cnt]