我的GUI工作正常。
这是我的编辑框GUI的屏幕截图:
F1触发脚本。
然后输入1、2、3或4,然后单击Submit或点击ENTER;Enter尚未被接受,但将其发送到隐藏模式或AHK世界中发生的我不知道的事情。-由davidmneedham修复-谢谢!
代码:无法完全正常工作
#NoEnv
#SingleInstance Force
F1::
aa := "1) opt 1 or (f)"
bb := "2) opt 2 (v)"
cc := "3) open opt 3"
dd := "4) open opt 4"
Gui, Add, Text, x50 y50 w100 h30, %aa%
Gui, Add, Text, x50 y70 w100 h30, %bb%
Gui, Add, Text, x50 y90 w300 h30, %cc%
Gui, Add, Text, x50 y110 w300 h30, %dd%
Gui, Add, Text, x50 y140 w50 h20, Selection:
Gui, Add, Edit, x100 y140 w100 h20 vChoice
Gui, Add, Text, x205 y140 w300 h30, (press ENTER)
;Gui, Add, Button, x50 y170 w50 h30 default gCancel, Cancel
;Gui, Add, Button, x130 y170 w50 h30 gSubmit, Submit
;Enter command fix by davidmneedham on StackExchangs thanks!
Gui, Add, Button, x50 y170 w50 h30 gCancel, Cancel
Gui, Add, Button, x130 y170 w50 h30 default gSubmit, Submit
Gui, Color, EEAA99
Gui +LastFound ; Make the GUI window the last found window for use by the line below.
WinSet, TransColor, ff00ff
Gui, Show, w350 h250, Enter Selection
;I even tried a while loop, here but it caused other problems
;while(true)
;{
; If (GetKeyState("f"))
; {
; msgbox, f pressed
; break
; }
;}
return
Submit:
Gui, Submit
if (Choice = "2")
{
msgbox chose 2
}
else if (Choice = "3")
{
msgbox chose 3
}
else if (Choice = "4")
{
msgbox chose 4
}
else
{
msgbox chose 1
}
ButtonCancel:
Gui, destroy
return
;One suggestion I tried this
#If WinActive("Download ahk_exe AutoHotkey.exe")
f:: Send 2{Tab 2}{Enter}
v:: Send 3{Tab 2}{Enter}
#If
我要包含的内容是:
F1,ENTER 1,2,3,4
或直接
按下f以触发“ 2,ENTER”
按下v以激发“ 3,ENTER”
我从(LINK CODE HERE_HOTKEYS)并查看此内容(LINK CODE HERE_KEYPRESS):
调查代码:
#SingleInstance force
Input, Key, L1
MsgBox You pressed %Key%!
OnExit ExitSub
return
ExitSub:
ExitApp
我似乎不知道如何将其合并到 F1激发脚本和接受GUI原始代码中,或者接受f或v,其中任何一行都将结束脚本,直到F1被按下才会再次运行。
概括: F1触发脚本 2,Enter 要么 3, Enter 要么 4, Enter 要么 f 要么 v ...结束脚本,直到再次按F1。