It's my first day on AHK. I am trying to assign a hotkey (0::9) after a key (Mbutton) is pressed a second time. Currently, 0 is assigned to 9 at runtime, regardless of the conditional statement.
What is the correct way to assign a hotkey after another key is pressed first?
Script:
MyVar := "no"
MButton::
if (MyVar = "no")
{
Send, 1
MyVar := "yes"
return
}
else
{
Send, {MButton}
0::9
return
}
Function for swap on button press
Re: Function for swap on button press
Like this:
Code: Select all
#SingleInstance Force
SendMode Input
Exit
MButton::Send % ((MyVar := !MyVar) ? "{MButton}" : "1") ;Toggles MyVar between True and False states (all variables are False by default, this is also true if they don't exist) and sends MButton/1.
#If MyVar ;If MyVar is True (has been toggled by MButton):
0::9
#If
Who is online
Users browsing this forum: No registered users and 83 guests