1
votes

I am new to AutoHotkey and have no programming experience, so sorry to ask what to many of you may be a very mundane question. One of my main uses for AutoHotkey will be to complete data in records I keep from an AutoHotkey ListBox. Using replies to other forum questions I have a working script as follows:

:*:\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

I wanted to include “, NoHide” after “Gui, Submit” above, but if I do that the script no longer works. Is there any way I can use the hotstring just once to launch the ListBox then have it stay on the desktop, so I can select other items as and when I get to other places in the records I keep where I need to select a different entry from the Listbox? If I remove "Gui, Destroy" from the script, the script also no longer works, so that does not appear to be the solution. Thanks in advance to anyone who can help.

1
I don't know if you are interested in this, but I expanded your app with an upload/download facility and the possibility to insert items with a sort of Copy. Let me know and I'll share it.Robert Ilbrink

1 Answers

0
votes

I just tested this modified script, which, when started, stays on top until YOU close it. Hope that that is what you wanted. If you close the Gui, the AHK script will close as well.

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

Update:

I could not help it, but had to add some more functionality. You can now double click on an item and it automatically moves to the next cell.

#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