selecting in listbox by keyboard Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jekko1976
Posts: 97
Joined: 10 Oct 2014, 07:03

selecting in listbox by keyboard

19 Jun 2020, 03:16

Hi all, i have this script that i use as "launcher" for other scripts:

Code: Select all

lista=
(join|
script1
script2
script3
)
Gui, font, s10, Arial
Gui, Add, ListBox, x10 y10 w350 h600 vMyScript gRunScript, %lista%
Gui, Show
Return

RunScript:
Gui, Submit, Destroy
Run, % A_ScriptDir . "\" MyScript . ".ahk"
ExitApp
Return
Well, this scripts works ony if I select the item BY A SINGLE CLICK OF MOUSE.
If I press the cursor down on the keyboard, it just launch the first script
What I wanna do instead, is to be able to select my script using cursor arrows up/down then pressing enter.
Any solutions?
Thank you very much
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: selecting in listbox by keyboard

19 Jun 2020, 03:28

Gui, Focus, MyScript and ...
To have list item(s) pre-selected when the window first appears, include two pipe characters after each (the Multi option is required if more than one item is to be pre-selected). Alternatively, include in Options the word Choose followed immediately by the number of an item to be pre-selected.
jekko1976
Posts: 97
Joined: 10 Oct 2014, 07:03

Re: selecting in listbox by keyboard

19 Jun 2020, 04:43

Thank you Bobo.
Unfortunately I am not so good in coding. I tried to modify the script but i can't make it work.
Could I ask you to modify my original script in the first post to make it work either with the mouse or with the cursor keys and the "enter"?
Sorry to bother you again about this :(
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: selecting in listbox by keyboard  Topic is solved

19 Jun 2020, 08:53

Code: Select all

#SingleInstance, Force

lista = 
(LTrim Join|
	script1
	script2
	script3
)

Gui, font, s10, Arial
Gui, Add, ListBox, x10 y10 w350 h600 vMyScript Choose1, %lista%
Gui, Show,,% chr(32)
KeyWait, Enter, D
Goto, Go
Return

Go:
	Gui, Submit, Destroy
	MsgBox % "Run, % A_ScriptDir . ""\" MyScript . ".ahk"""
	Return
jekko1976
Posts: 97
Joined: 10 Oct 2014, 07:03

Re: selecting in listbox by keyboard

19 Jun 2020, 09:37

Works as expected!
Thank you so much! :thumbup:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333, Google [Bot], songdg and 403 guests