Sign in to follow this  
Followers 0
tommeke228

FileFindFirstFile ?

7 posts in this topic

#1 ·  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

Share this post


Link to post
Share on other sites



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

:)

Share this post


Link to post
Share on other sites

#3 ·  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

Share this post


Link to post
Share on other sites

Ow thx

xD

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#6 ·  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

Share this post


Link to post
Share on other sites

Hehe, okay. :)

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