Edited Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
fivefive
Posts: 60
Joined: 07 May 2022, 14:16

Edited

Post by fivefive » 12 Aug 2022, 18:26

Edited
Last edited by fivefive on 12 Mar 2023, 10:46, edited 1 time in total.

User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: Same button but different functions each time?  Topic is solved

Post by mikeyww » 12 Aug 2022, 18:39

Code: Select all

F1::
If on := !on {
 Send a
} Else {
 Send b
}
Return

fivefive
Posts: 60
Joined: 07 May 2022, 14:16

Re: Same button but different functions each time?

Post by fivefive » 25 Aug 2022, 19:07

Edited
Last edited by fivefive on 12 Mar 2023, 10:46, edited 1 time in total.

sofista
Posts: 650
Joined: 24 Feb 2020, 13:59
Location: Buenos Aires

Re: Same button but different functions each time?

Post by sofista » 25 Aug 2022, 22:15

Surely it is possible. To get more states, just increment the initial value of the State variable and add the needed cases.

Code: Select all

F1::
	State := (State = 3) ? 1 : !State ? (State := 1) : ++State
	Switch State {
		case 1: Send, A
		case 2: Send, B
		case 3: Send, C
	}
return

Post Reply

Return to “Ask for Help (v1)”