ListBox中的AutoHotkey类型条目

时间:2013-03-16 15:27:49

标签: listbox autohotkey reusability

我是AutoHotkey的新手并且没有编程经验,很遗憾地问你们很多人可能是一个非常平凡的问题。 我对AutoHotkey的一个主要用途是完成我从AutoHotkey ListBox保留的记录中的数据。 使用对其他论坛问题的回复,我有一个如下工作脚本:

:*:\lb::
Gui, Add, ListBox, h100 vLB, apple||bannana|cantaloup|kiwi|orange|pomegranate|strawberry
Gui, Add, Button, Default, Input
Gui, Show
return

ButtonInput:
Gui, Submit
SendInput, %LB%
Gui, Destroy
Return

我想在上面的“Gui,Submit”之后添加“,NoHide”,但是如果我这样做,则脚本不再有效。 有没有什么方法我可以使用hotstring只启动一次ListBox然后让它留在桌面上,所以我可以选择其他项目当我到达记录中的其他地方我保留在哪里我需要选择一个不同的条目从列表框?如果我从脚本中删除“Gui,Destroy”,脚本也不再有效,因此似乎不是解决方案。 提前感谢任何可以提供帮助的人。

1 个答案:

答案 0 :(得分:0)

我刚刚测试了这个修改过的脚本,它在启动时会一直保持在最顶层,直到你关闭它为止。希望那就是你想要的。如果你关闭Gui,AHK脚本也会关闭。

SetTitleMatchMode, 2

;:*:\lb::
Gui, Add, ListBox, h100 vLB, apple||bannana|cantaloup|kiwi|orange|pomegranate|strawberry
Gui, Add, Button, Default, Input
Gui, +AlwaysOnTop
Gui, Show
return

ButtonInput:
Gui, Submit, NoHide
;MsgBox, %LB%
ControlSend,, %LB%, Part of your App title in the windows bar OR ahk_class ABCD (via AHK Windows Spy)
Return

GuiClose:
GuiEscape:
Gui, Destroy
ExitApp

更新

我无法帮助它,但必须添加更多功能。您现在可以双击某个项目,它会自动移动到下一个单元格。

#SingleInstance Force
#installKeybdHook
#Persistent

Gui, Add, ListBox, h100 vMyListBox gMyListBox, apple|bannana|cantaloup|kiwi|orange|pomegranate|strawberry
Gui, Add, Button, Default, Input
Gui, +AlwaysOnTop
Gui, Show
return

MyListBox:
if A_GuiControlEvent <> DoubleClick
    return
GuiControlGet, MyListBox  ; Retrieve the ListBox's current selection.
Send, !{Esc}
Sleep, 200
SendInput, %MyListBox%{Tab}
return

ButtonInput:
Gui, Submit, NoHide
Send, !{Esc}
Sleep, 200
SendInput, %MyListBox%{Tab}
Return

GuiClose:
GuiEscape:
Gui, Destroy
ExitApp