我在AutoHotKey中有一个GUI菜单,我遇到了麻烦。 GUI有三个名为“红色”,“蓝色”和“绿色”的按钮。AutoHotKey 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很新颖。
我彻底明白了,太感谢你了! – user2308604 2013-04-27 17:00:38