Hallo miteinenader ich han ein kleines problem mit dem sortieren von einträgen, vielleicht könnt ihr mir helfen
ich will einen ordner einlesen wo sich die neueste installations cds für meine programme befinden, anschließen eine install.ini erzeugen wo die pfade
nach datum sortiert sich befinden - leider klappt bei mir das sortieren nicht
hier mien script
; Shows the Folder Names of all Folders in the directory
#include <File.au3>
#include <String.au3>
#include <Array.au3>
#include <GUIConstants.au3>
$search = FileFindFirstFile("...\CDs\_AktuelleDVDs\*")
[/autoit][autoit][/autoit][autoit]; Check if the search was successful
If $search = -1 Then
MsgBox(0, "Error", "No files/directories matched the search pattern")
Exit
EndIf
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
$file1 = FileOpen("test.txt", 1)
[/autoit][autoit][/autoit][autoit]; Check if file opened for writing OK
If $file1 = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
FileWrite($file1, "["&$file &"]"&@CRLF) ;-- cd from Date/ datum ....
FileWrite($file1, "pfad=CDs\_AktuelleDVDs\"& $file & "\install.exe" & @CRLF) ; pfad - cd from Date/ datum ...
;~ write the data to textfile
FileClose($file1)
WEnd
FileClose($search)
[/autoit][autoit][/autoit][autoit][/autoit][autoit]Dim $array
[/autoit][autoit][/autoit][autoit];- array
If _FileReadToArray ("Test.txt", $Array) = 0 Then
Exit
EndIf
$array[0] = '' ; löscht erste zeile (delete raw counter)
[/autoit][autoit][/autoit][autoit]_FileWriteFromArray(@ScriptDir & "\install.ini",$array,0) ; output
[/autoit][autoit][/autoit][autoit]FileDelete(@ScriptDir & "\Test.txt")
[/autoit][autoit][/autoit][autoit];- Run("notepad.exe " & @ScriptDir & "\install.ini")
[/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit]
ausgabe:
[DVDpro4.0P_02.10.2009_DVD1]
pfad=\CDs\_AktuelleDVDs\DVDpro4.0P_02.10.2009_DVD1\install.exe
[DVDpro3.9P_06.10.2009]
pfad=\CDs\_AktuelleDVDs\DVDpro3.9P_06.10.2009\install.exe
[DVDpro3.9P_05.10.2009]
pfad=\CDs\_AktuelleDVDs\DVDpro3.9P_05.10.2009\install.exe
[DVDpro4.0P_02.10.2009_DVD2]
pfad=\CDs\_AktuelleDVDs\DVDpro4.0P_02.10.2009_DVD2\install.exe
[DVDpro3.9P_02.10.2009]
pfad=\CDs\_AktuelleDVDs\DVDpro3.9P_02.10.2009\install.exe
[DVD38pro_05.10.2009]
pfad=\CDs\_AktuelleDVDs\DVD38pro_05.10.2009\install.exe
[DVD38pro_06.10.2009]
pfad=\CDs\_AktuelleDVDs\DVD38pro_06.10.2009\install.exe
[DVD38pro_02.10.2009]
pfad=\CDs\_AktuelleDVDs\DVD38pro_02.10.2009\install.exe
[DVD38pro_01.10.2009]
pfad=\CDs\_AktuelleDVDs\DVD38pro_01.10.2009\install.exe
[DVDpro3.9P_01.10.2009]
pfad=\CDs\_AktuelleDVDs\DVDpro3.9P_01.10.2009\install.exe
ich bräuchte es aber nach dvd und dann datum sortiert
sollte so aussehen:
[DVDpro4.0P_02.10.2009_DVD1]
pfad=\CDs\_AktuelleDVDs\DVDpro4.0P_02.10.2009_DVD1\install.exe
[DVDpro4.0P_02.10.2009_DVD2]
pfad=\CDs\_AktuelleDVDs\DVDpro4.0P_02.10.2009_DVD2\install.exe
[DVDpro3.9P_06.10.2009]
pfad=\CDs\_AktuelleDVDs\DVDpro3.9P_06.10.2009\install.exe
[DVDpro3.9P_05.10.2009]
pfad=\CDs\_AktuelleDVDs\DVDpro3.9P_05.10.2009\install.exe
[DVDpro3.9P_02.10.2009]
pfad=\CDs\_AktuelleDVDs\DVDpro3.9P_02.10.2009\install.exe
[DVD38pro_06.10.2009]
pfad=\CDs\_AktuelleDVDs\DVD38pro_06.10.2009\install.exe
[DVD38pro_05.10.2009]
pfad=\CDs\_AktuelleDVDs\DVD38pro_05.10.2009\install.exe
[DVD38pro_02.10.2009]
pfad=\CDs\_AktuelleDVDs\DVD38pro_02.10.2009\install.exe
was mach ich falsch ????