How could I fill a list using files in a folder? - Forum

Forum Navigation
You need to log in to create posts and topics.

How could I fill a list using files in a folder?

I have a button that save all my variables in a txt file (in a Save folder). And I have a List Object. How can my List show all txt files in my save folder?.

I remember to do that in Neobook, but I don't remember how.

Thank you.

I have been trying with the code of an old Neobook project, and it works fine in Neobook, not in VisualNeoWin

 

FileList "Saves/*.sav" "Files" "[partidasguardadas]"

 

[partidasguardadas] doesn't appear in my variable list when I execute that code.

 

This is the code to save the file:

SaveVariables "Saves\[DayNum]-[Month] [Hour]_[Minute].sav"
ListBoxAddItem "ListaLoad" "1" "[DayNum]-[Month] [Hour]_[Minute].sav"
AlertBox "GAME SAVED" "Your game has been saved."

 

And this is the List code where should appear the list with the saves files (*.sav).

FileList "Saves/*.sav" "Files" "[partidasguardadas]"

This work well in Neobook.

 

 

 

Uploaded files:
  • You need to login to have access to uploads.
FileList "C:\Temp\*.txt" "Files" "[txts]"
StrParse "[txts]" "[#13]" "[MyFiles]" "[MyFilesCount]"
Loop "1" "[MyFilesCount]" "[MyFile]"
 ListBoxAddItem "ListBox1" "0" "[MyFiles[MyFile]]"
EndLoop

 

proforma.guyot has reacted to this post.
proforma.guyot

This is with Neobook. All perfect

 

 

Uploaded files:
  • You need to login to have access to uploads.
Quote from HPW on July 18, 2021, 3:52 pm
FileList "C:\Temp\*.txt" "Files" "[txts]"
StrParse "[txts]" "[#13]" "[MyFiles]" "[MyFilesCount]"
Loop "1" "[MyFilesCount]" "[MyFile]"
ListBoxAddItem "ListBox1" "0" "[MyFiles[MyFile]]"
EndLoop
FileList "C:\Temp\*.txt" "Files" "[txts]" StrParse "[txts]" "[#13]" "[MyFiles]" "[MyFilesCount]" Loop "1" "[MyFilesCount]" "[MyFile]" ListBoxAddItem "ListBox1" "0" "[MyFiles[MyFile]]" EndLoop
FileList "C:\Temp\*.txt" "Files" "[txts]"
StrParse "[txts]" "[#13]" "[MyFiles]" "[MyFilesCount]"
Loop "1" "[MyFilesCount]" "[MyFile]"
 ListBoxAddItem "ListBox1" "0" "[MyFiles[MyFile]]"
EndLoop

 

Thank you. I'll try that.

Finally my old code of Neobook works in VisualNeo Win (I don't know why this works if this is the same code before) . Thank you for all.

 

FileList "C:\Temp\*.txt" "Files" "[txts]"
ListBoxAddItem "ListBox1" "All" "[txts]"

HPW and proforma.guyot have reacted to this post.
HPWproforma.guyot

Does anyone know if the filelist command can be made to work recursively?

 

Thanks

Quote from rcohen on September 18, 2021, 8:06 am

Does anyone know if the filelist command can be made to work recursively?

I think that by itself the FileList command is not recursive, it only shows the files and folders of a given folder.

Greetings.

To do that, I usually use the command line:

SetVar "[Comando]" "[Folder]*.* /B /S > [#34]C:\Temp\List.txt[#34]"
Run "DIR" "[Comando]" "RunOnce+Wait+LoadComplete+Minimized+Hidden" "" ""

Greetings.