Jump to content

Recommended Posts

Posted (edited)

Uhm i have this

$search = FileFindFirstFile("*.txt") 


If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern",1)
EndIf

while 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
    _GUICtrlListBox_AddFile ($List1, $file)
wendoÝ÷ Ù»­§µ«­¢+ØÀÌØíÍÉ ô¥±¥¹¥ÉÍÑ¥±¡MÉ¥ÁѥȵÀìÅÕ½ÐìÀäÈíMÉ¥ÁÑÌÀäÈìÅÕ½ÐìµÀìÅÕ½Ð쨹ÑáÐÅÕ½Ðì¤

something like this

that it search in the scriptdir -> in the map -> and then look for txt files

can any help plz

Edited by tommeke228
Posted

Set the paths up and it may display what you want. FileFileFirstName() returns the filename so you need to build the path your self.

$search = FileFindFirstFile(@ScriptDir & "\Scripts\*.txt")

If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern", 1)
Else
    While 1
        $file = FileFindNextFile($search)
        If @error Then ExitLoop
        _GUICtrlListBox_AddFile($List1, @ScriptDir & "\Scripts\" & $file)
    WEnd
    FileClose($search)
EndIf

:)

Posted (edited)

What's wrong with:

$search = FileFindFirstFile(@ScriptDir & "\Scripts\*.txt")

If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern",1)
EndIf

while 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
    _GUICtrlListBox_AddFile ($List1, $file)
wend

?

Edit:

Doh, to slow. :)

Edited by FreeFry
Posted (edited)

Or is the problem you're having that you want it to search in the @ScriptDir folder, and all its subfolders for *.txt files?

uhm this code is working now

FileChangeDir(@scriptdir & "\scripts\")
$search = FileFindFirstFile("*.txt")


If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern",1)
EndIf

while 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
    _GUICtrlListBox_AddFile ($List1, $file)
wend

(all the txt files are saved in a map named Scripts)

thx

Edited by tommeke228

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
×
×
  • Create New...