我在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