【发布时间】:2020-11-26 03:05:40
【问题描述】:
我有一个脚本,它打开一个带有简单界面的 GUI,用 Esc 关闭,然后通过按钮提交。该脚本始终在后台运行。我正在尝试找到一种方法使 Enter 键作为提交工作,但在其他任何地方仍然正常工作。我试过使用 IfWinActive,但它不起作用。有任何想法吗?谢谢! (顺便说一下,有些代码在这种格式下看起来很乱,但是因为这不是完整的脚本,所以存在“不必要的细节”。)
Lwin & MButton::
Goto, Start
return
Start:
IfWinNotExist, New
{
Gui,1:-border
gui, font, s24, Product Sans ; Set 10-point Product Sans.
Gui, Add, Text,, Type here to search: ;controls the UI
Gui, Add, Edit, vTextInput
Gui, Add, Button, -WantReturn gSubmit w80, Go
Gui, Show, w400 h300, New
IfWinExist, New
Hotkey, Enter, Submit, On
return
}
Else
Return
IfWinExist, New
Esc::Gui, Destroy
return
IfWinExist, New
Enter::
Goto, Submit
return
Submit:
Gui, Submit ;destroys the UI when submitted
GuiControlGet, TextInput
Gui, Destroy
Else
{
link = https://www.google.com/search?q= %TextInput% ;search google
Run, %link%
}
【问题讨论】:
标签: autohotkey