#NoTrayIcon
#include <guiconstantsex.au3>
#include <windowsconstants.au3>
#include <file.au3>
#include <guiedit.au3>
#include <skin.au3>
#include <array.au3>
SkinStartLibrary()
$RenamerForm = GUICreate("Renamer", 650, 460, 600, 300, -1, $WS_EX_ACCEPTFILES)
AddSkin($RenamerForm, "B-style.skf")
$link = ""
GUICtrlCreateLabel("Renamer", 285, 10, 108, 30)
GUICtrlSetFont(-1, 20, 400, 2, "Comic Sans MS", 1)
$Input_Path = GUICtrlCreateInput($link, 210, 60, 240, 20, $ES_AUTOHSCROLL)
$browse = GUICtrlCreateButton("Browse...", 465, 56)
$number_name = GUICtrlCreateLabel("0", 120, 95, 100, 20)
GUICtrlSetFont(-1, 14, 400, 2)
$number_newname = GUICtrlCreateLabel("", 450, 95, 100, 20)
GUICtrlSetFont(-1, 14, 400, 2)
$Edit_Name = GUICtrlCreateEdit("", 30, 120, 270, 250)
$Edit_NewName = GUICtrlCreateEdit("", 350, 120, 270, 250)
$action = GUICtrlCreateButton("Rename", 280, 410, 80, 30)
$clear_Name = GUICtrlCreateButton("Clear", 95, 378, 35, 15)
GUICtrlSetFont(-1, 8, 400, 2)
GUICtrlSetTip($clear_Name, "Pulisci il box", "Clear", 1, 1)
$clear_NewName = GUICtrlCreateButton("Clear", 383, 378, 37, 15)
GUICtrlSetFont(-1, 8, 400, 2)
GUICtrlSetTip($clear_NewName, "Pulisci il box", "Clear", 1, 1)
$extract = GUICtrlCreateButton("Extract", 135, 378, 45, 15)
GUICtrlSetFont(-1, 8, 400, 2)
GUICtrlSetTip($extract, "Estrai i nomi in un file di testo", "Extract", 1, 1)
$insert = GUICtrlCreateButton("Insert", 425, 378, 38, 15)
GUICtrlSetFont(-1, 8, 400, 2)
GUICtrlSetTip($insert, "Inserisci i nomi da un file di testo", "Insert", 1, 1)
$replace = GUICtrlCreateButton("Replace", 468, 378, 45, 15)
GUICtrlSetFont(-1, 8, 400, 2)
GUICtrlSetTip($replace, "Sostituisci parole con altre", "Replace", 1, 1)
$randomize = GUICtrlCreateButton("Random", 518, 378, 45, 15)
GUICtrlSetFont(-1, 8, 400, 2)
GUICtrlSetTip($randomize, "Genera delle parole casuali", "Random", 1, 1)
$numbering = GUICtrlCreateButton("Numbering", 430, 398, 57, 15)
GUICtrlSetFont(-1, 8, 400, 2)
GUICtrlSetTip($numbering, "Numera tutte le parole", "Numera", 1, 1)
$past_right = GUICtrlCreateButton("=>", 185, 378, 25, 15)
GUICtrlSetFont(-1, 8, 400, 2)
GUICtrlSetTip($past_right, "Copia i nomi nella colonna di sinistra", "Esporta", 1, 1)
$trim = GUICtrlCreateButton("Cancella...", 490, 398, 55, 15)
GUICtrlSetFont(-1, 8, 400, 2)
GUICtrlSetTip($trim, "Cancella un determinato numero di caratteri", "Cancella...", 1, 1)
$about = GUICtrlCreateButton("About Me", 15, 15, 55)
GUICtrlSetFont(-1, 8.5, 400, 2)
GUISetState(@SW_SHOW)
GUICtrlSetState($Edit_Name, $GUI_DROPACCEPTED)
While 1
$read_Name = GUICtrlRead($Edit_Name)
$tmp_Name = StringReplace($read_Name, @CRLF, "?")
$Name = StringSplit($tmp_Name, "?")
$read_NewName = GUICtrlRead($Edit_NewName)
$tmp_NewName = StringReplace($read_NewName, @CRLF, "?")
$NewName = StringSplit($tmp_NewName, "?")
GUICtrlSetData($number_name, $Name[0]&" rows")
GUICtrlSetData($number_newname, $NewName[0]&" rows")
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case $browse
$path = FileSelectFolder("Scegli la cartella che contiene i file da rinominare!", @HomePath, 4, "", $RenamerForm)
If @error == 1 Then
$path = ""
ElseIf @error == 0 Then
If StringRight($path, 1) <> "\" Then
$path = $path & "\"
EndIf
$files = _FileListToArray($path, "*", 1)
If @error == 4 Then
MsgBox(0, "Errore!", "Non ho trovato nessun file!")
Elseif @error == 1 Then
MsgBox(00, "Errore", "path non valida")
Else
For $i = 1 To $files[0]
If StringInStr(FileGetAttrib($path & $files[$i]), "H") <> 0 Then
ElseIf StringRight(GUICtrlRead($Edit_Name), 1) <> "" Then
_GUICtrlEdit_AppendText($Edit_Name, @CRLF & $path & $files[$i])
ElseIf StringRight(GUICtrlRead($Edit_Name), 1) == "" Then
_GUICtrlEdit_AppendText($Edit_Name, $path & $files[$i])
EndIf
Next
EndIf
EndIf
Case $action
$read_Name = GUICtrlRead($Edit_Name)
$tmp_Name = StringReplace($read_Name, @CRLF, "?")
$Name = StringSplit($tmp_Name, "?")
$read_NewName = GUICtrlRead($Edit_NewName)
$tmp_NewName = StringReplace($read_NewName, @CRLF, "?")
$NewName = StringSplit($tmp_NewName, "?")
If $Name[0] > $NewName[0] Then
For $i = 1 To $Name[0]-$NewName[0]
_GUICtrlEdit_AppendText($Edit_NewName, @CRLF)
Next
EndIf
If $Name[0] < $NewName[0] Then
MsgBox(00, "Errore!", "Hai inserito troppi nuovi nomi")
EndIf
If $Name[0] == $NewName[0] Then
For $i = 1 To $Name[0]
If StringInStr($NewName[$i], "\") <> 0 Or StringInStr($NewName[$i], "/") <> 0 Or StringInStr($NewName[$i], ":") <> 0 Or StringInStr($NewName[$i], "?") <> 0 Or StringInStr($NewName[$i], "<") <> 0 Or StringInStr($NewName[$i], ">") <> 0 Or StringInStr($NewName[$i], "|") <> 0 Or StringInStr($NewName[$i], """") <> 0 Then
MsgBox(00, "Errore!", "I caratteri: \ / ? : < > | "" Non possono essere inseriti")
ExitLoop
Else
For $i = 1 To $Name[0]
$tmp_ext = StringSplit($Name[$i], ".")
$ext = "." & $tmp_ext[$tmp_ext[0]]
$tmp_link = StringSplit($Name[$i], "\")
$link = _ArrayToString($tmp_link, "\", 1, $tmp_link[0] - 1) & "\"
If $NewName[$i] == "" Then
$renaming = FileMove($Name[$i], $Name[$i], 1)
ElseIf $NewName[$i] <> "" Then
$renaming = FileMove($Name[$i], $link & $NewName[$i] & $ext)
EndIf
Next
If $renaming <> 0 Then
MsgBox(00, "Rinominazione completata!", "I File sono stati rinominati")
GUICtrlSetData($Edit_Name, "")
GUICtrlSetData($Edit_NewName, "")
Run(@ComSpec & ' /c ' & 'explorer.exe ' & $link & '', "", @SW_HIDE)
Else
MsgBox(00, "Rinominazione Fallita!", "Non sono riuscito a rinominare i file")
EndIf
EndIf
Next
EndIf
Case $clear_Name
GUICtrlSetData($Edit_Name, "")
Case $clear_NewName
GUICtrlSetData($Edit_NewName, "")
Case $extract
$txt = FileOpen(@DesktopDir & "\extract.txt", 1)
$read_NewName = GUICtrlRead($Edit_Name)
$tmp_NewName = StringReplace($read_NewName, @CRLF, "?")
$split = StringSplit($tmp_NewName, "?")
For $i = 1 To $split[0]
$tmp_NameFile = StringSplit($split[$i], "\")
$NameFile = StringTrimRight($tmp_NameFile[$tmp_NameFile[0]], 4)
FileWrite($txt, $NameFile & @CRLF)
Next
FileClose($txt)
Run(@ComSpec & ' /c ' & 'notepad.exe "' & @DesktopDir & '\extract.txt"', "", @SW_HIDE)
Case $insert
$TXTPath = FileOpenDialog("Scegli il File di testo", @HomePath, "Text files (*.txt)", 1, "", $RenamerForm)
If @error == 1 Then
$TXTPath = ""
ElseIf $TXTPath <> "" Then
$read_txt = FileRead($TXTPath)
If StringRight(GUICtrlRead($Edit_NewName), 1) <> "" Then
_GUICtrlEdit_AppendText($Edit_NewName, @CRLF & $read_txt)
ElseIf StringRight(GUICtrlRead($Edit_NewName), 1) == "" Then
_GUICtrlEdit_AppendText($Edit_NewName, $read_txt)
EndIf
EndIf
Case $replace
$Replace_gui = GUICreate("Replace", 290, 200, 38, 15)
GUICtrlCreateLabel("Rinomina:", 55, 35, 100, 20)
GUICtrlSetFont(-1, 10, 400, 2)
$old = GUICtrlCreateInput("", 20, 60, 130, 19)
GUICtrlCreateLabel("In:", 70, 95, 100, 20)
GUICtrlSetFont(-1, 10, 400, 2)
$new = GUICtrlCreateInput("", 20, 115, 130, 19)
$action_replace = GUICtrlCreateButton("Replace", 180, 114, 70, 30)
GUICtrlSetFont(-1, 10, 400, 2)
$casesense = GUICtrlCreateCheckbox("Case Sensitive", 170, 40)
$InputReplaceNum = GUICtrlCreateInput("", 175, 67, 80, 19)
$help_button = GUICtrlCreateButton("Help", 195, 92, 40, 15)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $action_replace
If GUICtrlRead($casesense) == 1 Then
$case = 1
ElseIf GUICtrlRead($casesense) == 4 Then
$case = 0
EndIf
$replaced = StringReplace(GUICtrlRead($Edit_NewName), GUICtrlRead($old), GUICtrlRead($new), GUICtrlRead($InputReplaceNum), $case)
GUICtrlSetData($Edit_NewName, $replaced)
Case $help_button
MsgBox(00, "Help Me!", "Puoi inserire nel box quante volte rinominare la parola."&@CRLF&"Il conteggio parte da sinistra ma nel caso vorresti farlo"&@CRLF&"partire da destra, basta inserire un numero negativo!")
EndSwitch
WEnd
GUIDelete($Replace_gui)
Case $randomize
$Random_gui = GUICreate("Random Words", 290, 200, 38, 15)
GUICtrlCreateLabel("Quanti ne creo?", 80, 25, 130, 20)
GUICtrlSetFont(-1, 10, 400, 2)
$rows = GUICtrlCreateInput("", 80, 50, 130, 19)
GUICtrlCreateLabel("Di quanti caratteri?", 80, 85, 160, 20)
GUICtrlSetFont(-1, 10, 400, 2)
$char = GUICtrlCreateInput("", 80, 110, 130, 19)
$submit = GUICtrlCreateButton("Genera", 100, 150, 80, 25)
GUICtrlSetFont(-1, 10, 400)
GUISetState(@SW_SHOW)
While 1
$read_NewName = GUICtrlRead($Edit_NewName)
$tmp_NewName = StringReplace($read_NewName, @CRLF, "?")
$NewName = StringSplit($tmp_NewName, "?")
GUICtrlSetData($number_newname, $NewName[0]&" rows")
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $submit
Local $all_num[GUICtrlRead($char)+1]
Local $array[20] = ["", "l", "d", "g", "s", "j", "o", "q", "m", "a", "h", "à", "è", "ù", "w", "x", "z", "$", "%", "^"]
For $x = 1 to GUICtrlRead($rows)
For $i = 1 to GUICtrlRead($char)
$num = Random(1, 19)
$all_num[$i] = $num
_GUICtrlEdit_AppendText($Edit_NewName, $array[$all_num[$i]])
Next
_GUICtrlEdit_AppendText($Edit_NewName, @CRLF)
Next
EndSwitch
WEnd
GUIDelete($Random_gui)
Case $numbering
$Numbering_gui = GUICreate("Numbering the name", 290, 200, 38, 15)
GUICtrlCreateLabel("Quanti ne numero?", 30, 25, 130, 20)
GUICtrlSetFont(-1, 10, 400, 2)
$number = GUICtrlCreateInput("", 30, 50, 130, 19)
GUICtrlCreateLabel("Il delimitatore?", 30, 85, 160, 20)
GUICtrlSetFont(-1, 10, 400, 2)
$delimiter = GUICtrlCreateInput("", 30, 110, 130, 19)
$start = GUICtrlCreateCheckbox("All'inizio!", 190, 70)
$end = GUICtrlCreateCheckbox("Alla fine!", 190, 90)
$submit = GUICtrlCreateButton("Numera", 50, 150, 80, 25)
GUICtrlSetFont(-1, 10, 400)
GUISetState(@SW_SHOW)
while 1
$read_NewName = GUICtrlRead($Edit_NewName)
$tmp_NewName = StringReplace($read_NewName, @CRLF, "?")
$NewName = StringSplit($tmp_NewName, "?")
GUICtrlSetData($number_newname, $NewName[0]&" rows")
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $submit
If GUICtrlRead(GUICtrlRead($number)) > $NewName[0] Then
$time = GUICtrlRead($number) - $NewName[0]
For $x = 1 To $time
_GUICtrlEdit_AppendText($Edit_NewName, @CRLF)
Next
EndIf
$read_NewName = GUICtrlRead($Edit_NewName)
$tmp_NewName = StringReplace($read_NewName, @CRLF, "?")
$NewName = StringSplit($tmp_NewName, "?")
GUICtrlSetData($Edit_NewName, "")
For $i = 1 To $NewName[0]
If $i <= GUICtrlRead($number) Then
If $i <= 9 Then
$i = "0"&$i
Endif
If GUICtrlRead($start) == 1 And GUICtrlRead($end) == 4 Or GUICtrlRead($start) == 4 And GUICtrlRead($end) == 4 Then
If StringRight(GUICtrlRead($Edit_NewName), 1) <> "" Then
_GUICtrlEdit_AppendText($Edit_NewName, @CRLF&$i&GUICtrlRead($delimiter)&$NewName[$i])
ElseIf StringRight(GUICtrlRead($Edit_NewName), 1) == "" Then
_GUICtrlEdit_AppendText($Edit_NewName, $i&GUICtrlRead($delimiter)&$NewName[$i])
EndIf
ElseIf GUICtrlRead($end) == 1 And GUICtrlRead($start) == 4 Then
If StringRight(GUICtrlRead($Edit_NewName), 1) <> "" Then
_GUICtrlEdit_AppendText($Edit_NewName, @CRLF&$NewName[$i]&GUICtrlRead($delimiter)&$i)
ElseIf StringRight(GUICtrlRead($Edit_NewName), 1) == "" Then
_GUICtrlEdit_AppendText($Edit_NewName, $NewName[$i]&GUICtrlRead($delimiter)&$i)
EndIf
ElseIf GUICtrlRead($end) == 1 And GUICtrlRead($start) == 1 Then
If StringRight(GUICtrlRead($Edit_NewName), 1) <> "" Then
_GUICtrlEdit_AppendText($Edit_NewName, @CRLF&$i&GUICtrlRead($delimiter)&$NewName[$i]&GUICtrlRead($delimiter)&$i)
ElseIf StringRight(GUICtrlRead($Edit_NewName), 1) == "" Then
_GUICtrlEdit_AppendText($Edit_NewName, $i&GUICtrlRead($delimiter)&$NewName[$i]&GUICtrlRead($delimiter)&$i)
EndIf
EndIf
ElseIf $i > GUICtrlRead($number) Then
If StringRight(GUICtrlRead($Edit_NewName), 1) <> "" Then
_GUICtrlEdit_AppendText($Edit_NewName, @CRLF&$NewName[$i])
ElseIf StringRight(GUICtrlRead($Edit_NewName), 1) == "" Then
_GUICtrlEdit_AppendText($Edit_NewName, $NewName[$i])
EndIf
EndIf
Next
EndSwitch
WEnd
GUIDelete($Numbering_gui)
Case $past_right
$read_NewName = GUICtrlRead($Edit_Name)
$tmp_NewName = StringReplace($read_NewName, @CRLF, "?")
$split = StringSplit($tmp_NewName, "?")
For $i = 1 To $split[0]
$tmp_NameFile = StringSplit($split[$i], "\")
$NameFile = StringTrimRight($tmp_NameFile[$tmp_NameFile[0]], 4)
If StringRight(GUICtrlRead($Edit_NewName), 1) <> "" Then
_GUICtrlEdit_AppendText($Edit_NewName, @CRLF&$NameFile)
ElseIf StringRight(GUICtrlRead($Edit_NewName), 1) == "" Then
_GUICtrlEdit_AppendText($Edit_NewName, $NameFile)
EndIf
Next
Case $trim
$trim_gui = GUICreate("Cancella delle lettere!", 190, 200, 38, 15)
GUICtrlCreateLabel("Quante ne cancello?", 30, 25, 130, 20)
GUICtrlSetFont(-1, 10, 400, 2)
$count = GUICtrlCreateInput("", 30, 50, 130, 19)
$start = GUICtrlCreateCheckbox("All'inizio!", 60, 85)
$end = GUICtrlCreateCheckbox("Alla fine!", 60, 105)
$submit = GUICtrlCreateButton("Cancella!", 50, 150, 80, 25)
GUICtrlSetFont(-1, 10, 400)
GUISetState(@SW_SHOW)
while 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $submit
If GUICtrlRead(GUICtrlRead($count)) > $NewName[0] Then
$time = GUICtrlRead($count) - $NewName[0]
For $x = 1 To $time
_GUICtrlEdit_AppendText($Edit_NewName, @CRLF)
Next
EndIf
$read_NewName = GUICtrlRead($Edit_NewName)
$tmp_NewName = StringReplace($read_NewName, @CRLF, "?")
$NewName = StringSplit($tmp_NewName, "?")
GUICtrlSetData($Edit_NewName, "")
For $i = 1 To $NewName[0]
If GUICtrlRead($start) == 1 And GUICtrlRead($end) == 4 Or GUICtrlRead($start) == 4 And GUICtrlRead($end) == 4 Then
$trimmed = StringTrimLeft($NewName[$i], GUICtrlRead($count))
If StringRight(GUICtrlRead($Edit_NewName), 1) <> "" Then
_GUICtrlEdit_AppendText($Edit_NewName, @CRLF&$trimmed)
ElseIf StringRight(GUICtrlRead($Edit_NewName), 1) == "" Then
_GUICtrlEdit_AppendText($Edit_NewName, $trimmed)
EndIf
ElseIf GUICtrlRead($end) == 1 And GUICtrlRead($start) == 4 Then
$trimmed = StringTrimRight($NewName[$i], GUICtrlRead($count))
If StringRight(GUICtrlRead($Edit_NewName), 1) <> "" Then
_GUICtrlEdit_AppendText($Edit_NewName, @CRLF&$trimmed)
ElseIf StringRight(GUICtrlRead($Edit_NewName), 1) == "" Then
_GUICtrlEdit_AppendText($Edit_NewName, $trimmed)
EndIf
ElseIf GUICtrlRead($end) == 1 And GUICtrlRead($start) == 1 Then
$r_trimmed = StringTrimLeft($NewName[$i], GUICtrlRead($count))
$l_trimmed = StringTrimRight($r_trimmed, GUICtrlRead($count))
If StringRight(GUICtrlRead($Edit_NewName), 1) <> "" Then
_GUICtrlEdit_AppendText($Edit_NewName, @CRLF&$l_trimmed)
ElseIf StringRight(GUICtrlRead($Edit_NewName), 1) == "" Then
_GUICtrlEdit_AppendText($Edit_NewName, $l_trimmed)
EndIf
EndIf
Next
EndSwitch
WEnd
GUIDelete($trim_gui)
Case $about
MsgBox(00, "About Developer!", " Thinked and Created by Jhacked, Alias"&@CRLF&" of Giacomo Cerquone."&@CRLF&" Please, if you find bugs, send me"&@CRLF&" an e-mail on my site:"&@CRLF&@CRLF&"
http://nativity.altervista.org/"&@CRLF&" Enjoy
")
EndSwitch
WEnd