Dear AutoIt members,
I want to make a simple script: rename file-name (inputbox) with the extension rar if the extension ends up with part001.rar, part002.rar and so on rename to r01, r02
renaming the the extension is not the problem i found on this forum a good example script
now renaming the filename with the given inputbox name
Thanks
I want to make a simple script: rename file-name (inputbox) with the extension rar if the extension ends up with part001.rar, part002.rar and so on rename to r01, r02
renaming the the extension is not the problem i found on this forum a good example script
now renaming the filename with the given inputbox name
FileMove($Directory & "\" & $files[$x], $Directory & "\" & $Input1[1] & ".r0" & $x)above code is wrong it was
FileMove($Directory & "\" & $files[$x], $Directory & "\" & $files[1] & ".r0" & $x)this is just for example to show
[ autoit ]
#NoTrayIcon #include <file.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) Local $Directory = @ScriptDir Local $Gui, $Input1, $Button1, $nMsg, $i $Gui = GUICreate("Form1", 184, 91, 192, 124) $Input1 = GUICtrlCreateInput("", 24, 16, 144, 21) $Button1 = GUICtrlCreateButton("Button1", 24, 48, 145, 25, $WS_GROUP) GUISetState(@SW_SHOW) $i = 1 While 1 If GUICtrlRead($Input1) = "" And $i = 1 Then GUICtrlSetState($Button1, $GUI_DISABLE) $i = 0 Else If $i = 0 And GUICtrlRead($Input1) <> "" Then GUICtrlSetState($Button1, $GUI_ENABLE) $i = 1 EndIf EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _rar01() EndSwitch WEnd Func _rar01() Local $files, $filename, $x $files = _FileListToArray($Directory, "*.rar", 1) For $x = 1 To UBound($files) - 1 $filename = StringSplit($files[$x], ".") If $x < 10 Then FileMove($Directory & "\" & $files[$x], $Directory & "\" & $Input1[1] & ".r0" & $x) Else FileMove($Directory & "\" & $files[$x], $Directory & "\" & $Input1[1] & ".r" & $x) EndIf Next EndFunc
Thanks