Switching between macros

Ask gaming related questions (AHK v1.1 and older)
icic
Posts: 1
Joined: 19 Jun 2017, 11:55

Switching between macros

19 Jun 2017, 12:02

Hi im really bad at this dont really know what im doing, just trying to edit a script from somewhere else
So lets say i have the macros below

Code: Select all

PressA:
Send {a}{Enter}
return

PressB:
Send {b}{Enter}
return
With the hotkey,
With the key that is executing one of the macros being F1

Code: Select all

ButtonPressed := "F1"
How do I switch between the two macros PressA and PressB which is in F1 by pressing another key like F2?

Code: Select all

Hotkey, %ButtonPressed%, PressA

Hotkey, %ButtonPressed%, PressB
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Switching between macros

19 Jun 2017, 14:07

You could do this by changing the hotkey, but there is not really any point in getting that complex for what you want.

Code: Select all

a := 1

F1::
	if (a == 1){
		Send {a}
	} else {
		Send {b}
	}
	return

F2::
	a := !a ; Toggles var a between 1 and 0
	return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: sofista and 156 guests