Get All Selected Files in ListBox

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
MusoCity
Posts: 95
Joined: 24 Mar 2018, 20:45

Get All Selected Files in ListBox

14 Sep 2023, 03:28

I want to loop through all the multiple selected file names in the ListBox

Code: Select all

loop C:\Temp\Scripts\*.* {
	ListScripts .= "|" . a_LoopFilename
}
ListScripts := substr(ListScripts,2)

Gui, Add, ListBox, x10 y100 w600 h190 Multi vMyListBoxVariable, %ListScripts%
User avatar
mikeyww
Posts: 27366
Joined: 09 Sep 2014, 18:38

Re: Get All Selected Files in ListBox

14 Sep 2023, 08:01

Code: Select all

#Requires AutoHotkey v1.1.33
dir  := A_ScriptDir "\t"
list := ""
Loop Files, % dir "\*.*"
 list .= (list = "" ? "" : "|") A_LoopFileName
Gui Font, s10
Gui Add, ListBox, w500 r20 Multi vsel, % list
Gui Add, Button , wp   Default, OK
Gui Show
Return

ButtonOK:
Gui Submit
For each, item in StrSplit(sel, "|") {
 MsgBox % item
}
Return
garry
Posts: 3795
Joined: 22 Dec 2013, 12:50

Re: Get All Selected Files in ListBox

15 Sep 2023, 11:04

@mikeyww thank you , works fine .
The same to show all selected ( if needed )

Code: Select all

#Requires AutoHotkey v1.1.33
#warn
e:=""
dir  := a_desktop
list := ""
Loop Files, % dir "\*.*"
 list .= (list = "" ? "" : "|") A_LoopFileName
Gui Font, s10
Gui Add, ListBox, w500 r20 Multi vsel, % list
Gui Add, Button , wp   Default, OK
Gui Show
Return
;------------
ButtonOK:
Gui,Submit,nohide
e:=""
For each, item in StrSplit(sel, "|") {
 ;MsgBox % item
 e .= item . "`n"
}
msgbox,%e%
Return
;------------
Guiclose:
exitapp
;====================


Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Draken, oktavimark, Spawnova, william_ahk and 279 guests