Hallo zusammen,
ich bin jetzt ein Tool am programmieren, mit dem ich die Dateiname umbenennen kann.
So weit bin ich schon gekommen:
Spoiler anzeigen
#Region ### START Koda GUI section ### Form=
Local $Form1 = GUICreate("Rename", 390, 70, -1, -1)
Local $Label1 = GUICtrlCreateLabel("Verzeichnis:", 10, 12, 60, 12)
Local $Input1 = GUICtrlCreateInput("", 80, 10, 280, 20)
Local $Button1 = GUICtrlCreateButton("...", 364, 10, 20, 20, 0)
Local $Label2 = GUICtrlCreateLabel("", 10, 47, 200, 16)
Local $Button2 = GUICtrlCreateButton("Ersetze", 220, 45, 80, 20, 0)
GUICtrlSetState($Button2, $GUI_DEFBUTTON)
Local $Button3 = GUICtrlCreateButton("Ende", 304, 45, 80, 20, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Button2
GUICtrlSetState($Button2, $GUI_DISABLE)
GUICtrlSetState($Button3, $GUI_DISABLE)
$search = FileFindFirstFile(GUICtrlRead($Input1) & "\*.*")
If $search = -1 Then
MsgBox(262160, "Fehler", "Keine Dateien gefunden !!!")
Exit
EndIf
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
$newfile = StringReplace($file, " ", "_")
$newfile = StringReplace($newfile, "§", "p")
$newfile = StringReplace($newfile, "ü", "ue")
$newfile = StringReplace($newfile, "Ü", "Ue")
$newfile = StringReplace($newfile, "ö", "oe")
$newfile = StringReplace($newfile, "Ö", "Oe")
$newfile = StringReplace($newfile, "ä", "ae")
$newfile = StringReplace($newfile, "Ä", "Ae")
$newfile = StringReplace($newfile, "ß", "ss")
GUICtrlSetData($Label2, $newfile)
FileMove(GUICtrlRead($Input1) & '\' & $file, GUICtrlRead($Input1) & '\' & $newfile, 0)
WEnd
FileClose($search)
GUICtrlSetState($Button2, $GUI_ENABLE)
GUICtrlSetState($Button3, $GUI_ENABLE)
Case $Button1
$l = FileSelectFolder("Verzeichnisauswahl:", @ScriptDir, 1)
GUICtrlSetData($Input1, $l)
Case $Button3
Exit
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Jetzt möchte ich die StringReplace-Anweisungen über ein Config-Datei steuern.
Hat jemand eine Idee wie ich das angehen kann?
Die INI sieht so aus:
[autoit][Replace]
=_
§=p
ü=ue
Ü=Ue
ö=oe
Ö=Oe
ä=ae
Ä=Ae
ß=ss
und wird vom Script auch gefunden.