Sign in to follow this  
Followers 0
dynamitemedia

Read folder for filenames by extension and add to listview

2 posts in this topic

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



#2 ·  Posted (edited)

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])))
Next

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)
EndFunc


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


Func GetFileName($Input)
Local $PathArray = StringSplit($Input, "\/")
Return $PathArray[$PathArray[0]]
EndFunc
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  
Followers 0