Hallo Leute,
Kann jemand vlt. helfen, ich hab kleine Programm erstellt, womit ich ein Ordner Kopiere und in einem neuen Pfad einfügen kann. die Endungen der Datein in der Neuer Ordner sollen umbennant.
Ich kann den Pfad irgendwie nicht auswählen, kann ich irgendwie nur die Endungen einem Art von Dateien umbennen und den Rest bleibt.
C
#include <GUIConstants.au3>
#include <ComboConstants.au3> ; For GUICtrlCreateCombo
#include <File.au3> ; For _FileListToArray
Global $ComboExt, $Files ; For Find Files.
$Form1 = GUICreate("file's copy & rename the Extension ", 618, 134, 193, 125)
$Input_old = GUICtrlCreateInput("", 16, 16, 321, 21)
$Datei = GUICtrlCreateButton("choose folder or file's ", 352, 16, 257, 25, 0)
$Go = GUICtrlCreateButton("copy and rename ", 136, 88, 361, 41, 0)
$Input_new = GUICtrlCreateInput("", 16, 48, 321, 21)
$Button1 = GUICtrlCreateButton("new path or folder", 352, 48, 257, 25, 0)
GUICtrlSetCursor($Datei, 0) ; ==> Added.
GUICtrlSetCursor($Go, 0) ; ==> Added.
GUICtrlSetCursor($Button1, 0) ; ==> Added.
GUICtrlCreateLabel("New Extensions", 520, 80, 80, 20, 1) ; ==> Added.
$ComboExt = GUICtrlCreateCombo("", 510, 100, 100, 50, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) ; ==> Added.
GUICtrlSetData($ComboExt, ".jpg|.bmp|.png|.gif|", ".jpg") ; Choose The New Extensions Post File Move. ==> Added.
GUICtrlSetCursor($ComboExt, 0) ; ==> Added.
GUISetState(@SW_SHOW, $Form1)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit(0)
Case $Datei
;~ ;$path = FileOpenDialog("choose folder or file's", @ScriptDir, "Alle Dateien (*.*)")
$path = FileSelectFolder("choose folder or file's", @ScriptDir) ; Correction / Added.
GUICtrlSetData($Input_old, $path)
Case $Button1
;~ ;$path_new = FileSelectFolder ( "choose folder or file's", @ScriptDir, "Alle Dateien (*.*)")
$path_new = FileSelectFolder("choose folder or file's", @ScriptDir, 1) ; Correction / Added.
GUICtrlSetData($Input_new, $path_new)
Case $Go
GUICtrlSetState($Go, $GUI_DISABLE)
GUICtrlSetState($Datei, $GUI_DISABLE)
GUICtrlSetState($Button1, $GUI_DISABLE)
GUICtrlSetData($Go, "wait!.")
$Files = _FileListToArray($path , "*.*" , 1) ; 1 = Return Files Only. ==> Added.
If Not @error Then _Copy($Files) ; ==> Added.
EndSwitch
WEnd
Func _Copy($Files) ; Copies All Files to The New Location With The Extension You Have Chosen.
Local $ReadExt = GUICtrlRead($ComboExt)
For $i = 0 To UBound($Files)-1
FileCopy($path & "\" & $Files[$i], $path_new & "\" & StringRegExpReplace($Files[$i], ".*\\|\.[^.]*", "") & $ReadExt)
Next
GUICtrlSetState($Go, $GUI_ENABLE)
GUICtrlSetState($Datei, $GUI_ENABLE)
GUICtrlSetState($Button1, $GUI_ENABLE)
GUICtrlSetData($Go, "End of copy")
EndFunc
Alles anzeigen