Jump to content
Sign in to follow this  

Read folder for filenames by extension and add to listview

Recommended Posts


I have a folder that is called "plugins"

it has some bat files and some txt files in the folder.

I want to read the folder and list only the bat files int the list view and when i click it and it highlights i want to be able to pass that to the bat file.

you can send variables  to bat files in php etc so i assuming it can be done here too.

Thank you very much

Share this post

Link to post
Share on other sites

wow i actually got it that quickly!  for anyone who needs to know my code is like this:

$List2 = GUICtrlCreateList("", 32, 88, 521, 174)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")

Local $FileList = _FileListToArray("plugins", "*.bat*")

For $i = 1 To $FileList[0]
        GUICtrlSetData($List2, RemoveExt(GetFileName($FileList[$i])))

the functions are like this and i got them here 


I wanted to not actually show extension either so i added the functions below

; ------------------  Functions  ---------------------------
Func RemoveExt($Input)
Local $ExtArray = StringSplit($Input, ".")
Return StringReplace($Input, "." & $ExtArray[$ExtArray[0]], "", -1)

Func RemoveExtRegExp($Input)
Return StringRegExpReplace($Input, "\.[^.]*$", "")

Func GetFileName($Input)
Local $PathArray = StringSplit($Input, "\/")
Return $PathArray[$PathArray[0]]
Edited by dynamitemedia

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.