我在 AutoHotKey 中有一个 GUI 菜单,但我遇到了问题。GUI 有三个按钮,分别命名为“红色”、“蓝色”和“绿色”。
当用户点击说“红色”时,就会发生一个动作。如果用户点击说“蓝色”,就会发生不同的动作。
循环是用 F4 键开始的,但根据按下的按钮不同,应该循环不同的东西:红色、蓝色或绿色。
这是我到目前为止的脚本:
Gui, Add, Tab, x366 y377 w-100 h-400 , Tab1
Gui, Add, Picture, x6 y7 w320 h90 , C:\IMAGEFILEHERE
Gui, Add, Text, x46 y147 w140 h40 , Spawning Team
Gui, Add, Button, x206 y117 w120 h20 , Red
Gui, Add, Button, x206 y147 w120 h20 , Blue
Gui, Add, Button, x206 y177 w120 h20 , Green
Gui, Show, x436 y230 h208 w336, SCRIPTNAME
Loop
{
If run =
{
sleep,250
continue
}
Else
{
if (Team = "Red") ; If Red is selected, run this part
{
ACTION1HERE
}
if (Team = "Blue") ; If Blue is selected, run this part
{
ACTION2HERE
}
if (Team = "Green") ; If Green is selected, run this part
{
ACTION3HERE
}
}
}
return
F4::
If run =
run = 1
Else
run =
return
ButtonRed:
Team = Red.
MsgBox The value in the variable named Team is %Team%.
Return
ButtonBlue:
Team = Blue.
MsgBox The value in the variable named Team is %Team%.
Return
ButtonGreen:
Team = Green.
MsgBox The value in the variable named Team is %Team%.
Return
问题是 if 语句没有检测到被按下的按钮。
任何帮助深表感谢!^_^ 我对 AHK 很陌生。