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

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Wontyd
Posts: 1
Joined: 19 Jul 2019, 21:16

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

19 Jul 2019, 21:29

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 ;)
scriptor2016
Posts: 860
Joined: 21 Dec 2015, 02:34

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

19 Jul 2019, 23:00

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
Odlanir
Posts: 659
Joined: 20 Oct 2016, 08:20

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

20 Jul 2019, 03:54

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]
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada and 309 guests