Davidddd Posted April 17, 2006 Share Posted April 17, 2006 Hello! here is my problem: I want to get the files in a directory in alphabetical order, or at least in creation order. FileFindNextFile ( search ) gives me the files ordered by access time thanks !!!!!!!! Link to comment Share on other sites More sharing options...
Valuater Posted April 17, 2006 Share Posted April 17, 2006 #Include <File.au3> #Include <Array.au3> $FileList=_FileListToArray(@DesktopDir) If (Not IsArray($FileList)) and (@Error=1) Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf _ArrayDisplay($FileList,"$FileList") 8) Link to comment Share on other sites More sharing options...
Davidddd Posted April 17, 2006 Author Share Posted April 17, 2006 WOW that was fast!!! but i can´t make it work where is _FileListToArray() defined? archivos.au3(3,39) : ERROR: _FileListToArray(): undefined function. $FileList=_FileListToArray(@DesktopDir) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Documents and Settings\David\Escritorio\David\Uso de pc\archivos.au3 - 1 error(s), 0 warning(s) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 17, 2006 Moderators Share Posted April 17, 2006 WOW that was fast!!! but i can´t make it workwhere is _FileListToArray() defined?archivos.au3(3,39) : ERROR: _FileListToArray(): undefined function.$FileList=_FileListToArray(@DesktopDir)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^C:\Documents and Settings\David\Escritorio\David\Uso de pc\archivos.au3 - 1 error(s), 0 warning(s)It's in the Beta File.au3. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
herewasplato Posted April 17, 2006 Share Posted April 17, 2006 (edited) It's in the Beta File.au3....and the beta version of AutoIt can be found here:http://www.autoitscript.com/autoit3/files/beta/autoit/Welcome to the forums Davidddd..... Edited April 17, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Valuater Posted April 17, 2006 Share Posted April 17, 2006 Taken from Lesson #6 of "Welcome to Autoit 1-2-3"... in my signature expandcollapse popup; includes #include <GuiConstants.au3> #include <file.au3> ;****************** FILE LOCATION ********** $File_loc = @ScriptDir & "\" $File_type = "*.txt" ;******************************************** ; create the GUI. $win = GUICreate("File List/View Demo", 614, 370) ; set the font for the GUI GUISetFont(9, 400, -1, "MS Sans Serif") ; create buttons. $btnList = GUICtrlCreateButton("&List Files", 10, 330, 75, 25) $btnView = GUICtrlCreateButton("&View File", 85, 330, 75, 25) ; create the left list. $TutorItList = GUICtrlCreateList("", 10, 10, 150, 330) ; create the right edit. $TutorItEdit = GUICtrlCreateEdit("Please select a tutorial from the list to your left.", 175, 10, 420, 345, $ES_AUTOVSCROLL + $ES_READONLY + $ES_MULTILINE + $WS_VSCROLL) ; set the edit colors. GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetColor(-1, 0x000000) ; set focus to the edit. GUICtrlSetState($TutorItList, $GUI_FOCUS) ; show the GUI. GUISetState() ; start the loop. While 1 ; listen for a message $msg = GUIGetMsg() ; using select/case for the message Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $btnList Set_tutor() Case $msg = $btnView View_tutor() ; end the selections EndSelect WEnd ; Function to populate the left list. Func Set_tutor() $TutList = _FileListToArray ($File_loc, $File_type, 1); list files to an array. If (Not IsArray($TutList)) Or (@error = 1) Then MsgBox(262208, "Tutor Error", "No Files\Folders Found. ", 5) Return EndIf GUICtrlSetData($TutorItList, ""); set list to empty. For $x = 1 To $TutList[0]; for loop to place the files in the list. GUICtrlSetData($TutorItList, (StringTrimRight($TutList[$x], 4)) & "|", 1); string trim the last 4 characters ( .txt ) Next EndFunc ; Function to populate the right edit. Func View_tutor() $s_text = GUICtrlRead($TutorItList); read the selected file to a variable. If $s_text = "" Then Return $n_text = StringTrimLeft($File_type, 1) $s_text = $File_loc & $s_text & $n_text; set the location of the file. Dim $Tut_text If Not _FileReadToArray($s_text, $Tut_text) Then; read the file to an array. MsgBox(4096, "Tutor Error", " Error reading log to Array error:" & @error) Return EndIf GUICtrlSetData($TutorItEdit, ""); set the edit to empty. For $x = 1 To $Tut_text[0]; for loop to place the read file into the edit. GUICtrlSetData($TutorItEdit, $Tut_text[$x] & @CRLF, 1) Next EndFunc 8) Link to comment Share on other sites More sharing options...
blindwig Posted April 17, 2006 Share Posted April 17, 2006 Also take a look at this thread:http://www.autoitscript.com/forum/index.php?showtopic=23087 My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
Davidddd Posted April 18, 2006 Author Share Posted April 18, 2006 thanks you all!! you had been very useful!!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now