Jump to content

List files in a directory


Recommended Posts

When i run this script, it puts a "1" in the list box and throws my cpu to about 60. It's usually about 20 (I just re-formatted)

Actually, with this code it does nothing with the list box :whistle:

Anyone know whats wrong?

EDIT: I got the first file working, just not next file

#include <GUIConstants.au3>
$search = FileFindFirstFile("*.*")  
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 516, 574, 192, 125)
$List1 = GUICtrlCreateList("", 48, 16, 401, 500, -1, $WS_EX_CLIENTEDGE)
$Button1 = GUICtrlCreateButton("refresh", 120, 536, 273, 25)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button1
        GUICtrlSetData($List1, $search)
        While $search = 1
        GUICtrlSetData($List1, FileFindNextFile($search))
        WEnd
        EndSelect
WEnd
Exit

Thanks all,

Codemyster

Edited by codemyster
Link to comment
Share on other sites

#include <Process.au3>
#include <GUIConstants.au3>
$search = _RunDOS("dir /b >> Files.log")
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 516, 574, 192, 125)
$List1 = GUICtrlCreateList("", 48, 16, 401, 500, -1, $WS_EX_CLIENTEDGE)
$Button1 = GUICtrlCreateButton("refresh", 120, 536, 273, 25)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $button1
        $file = FileOpen("Files.log", 0)
        While 1
            $line = FileReadLine($file)
            If @error = -1 Then ExitLoop
            GUICtrlSetData($list1,$line)
        Wend
    EndSelect
WEnd
Exit

..your just listing the files right?

//edit: Are you specifically needing to use the FileFind functions? because this works just as good with -2% hassle

Edited by B3TA_SCR1PT3R

[right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right]

Link to comment
Share on other sites

I'm just trying to get it to list the files in a list control. This will help me with my other project i'm working on (A program to help me transfer files between my pc-phone)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...