如何解决Autohotkey-如何使用向上和向下箭头键导航单选列表?
我有以下脚本。我不确定如何使用向上或向下箭头键修改它以浏览结果。要运行它,只需创建一个.txt文件并在其中添加一些单词(每行一个单词),然后将文件路径编辑到.txt文件所在的位置。然后,只需搜索至少在两行中找到的关键字即可。例如
Word1
Word2
如果您搜索单词,它将同时返回单词1和单词2。然后,我只需要使用向上和向下箭头键在它们之间进行选择即可。
F9::
{
FilePath := "D:\5. Programs\AutoHotkey L x64\test.txt"
Gui,Destroy
Gui,Font,S20
Gui,Add,Text,X25 Y10 W450 H30 +Center,Search Box
Gui,S10
Gui,Edit,XP Y+20 W450 H20 vSearchString,Gui,Color
Gui,Show,W500 H100,Search Box
return
#IfWinActive,Search Box
{
Enter::
Gui,Submit,NoHide
ResultList := []
ChosenString := ""
Loop,Read,%FilePath%
{
if (InStr(A_LoopReadLine,SearchString))
{
ResultList.Push(A_LoopReadLine)
}
}
if (!ResultList.Length())
{
;MsgBox % "No match found!"
return
}
Gui,displayResults:New,-MaximizeBox -MinimizeBox,Search results
Gui,w250,% "Click on one of the results below:"
for key,value in ResultList
{
if (key = 1)
Gui,Radio,gSelectResult vChosenString,%value%
else
Gui,gSelectResult,%value%
}
Gui,displayResults:Show
return
SelectResult:
Gui,displayResults:Submit
;MsgBox,% ResultList[ChosenString]
Clipboard := % ResultList[ChosenString]
return
}
}
return
解决方法
您不希望GUI消失吗?
像这样在行号44中添加NoHide
:
Gui,DisplayResults:Submit,NoHide
。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。