; idea from http://www.donationcoder.com/Forums/bb/index.php?topic=19413.0 ; author: kli6891 ; email: kli6891 g.m.a.i.l com origNameArray = fileDir = fileCount = 0 Gui, Add, Button, x12 y10 w80 h30 , Select Files Gui, Add, Button, x112 y10 w90 h30 , Save and Close Gui, Add, Edit, x22 y50 w300 h260 vMyEdit, Gui, Add, Button, x222 y10 w100 h30 , Discard and Close ; Generated using SmartGUI Creator 4.2 Gui, Show, x255 y249 h337 w337, New GUI Window Return GuiClose: ButtonDiscardandClose: ExitApp ButtonSelectFiles: ; get the files users wants to rename, and then load them into the edit box fileCount = 0 origNameArray = FileSelectFile, filesSelected, M3 if (errorlevel == 1) ; user pressed cancel { return } else { Loop, PARSE, filesSelected, `n, `r ; in this loop, write the file names selected into an array { if (A_Index == 1) ; the folder name, skip it { fileDir := A_LoopField SetWorkingDir %fileDir% continue } fileCount++ origNameArray%fileCount% := A_LoopField } Loop, %fileCount% ; then copy the array into the edit box { if (A_Index == 1) { if (fileCount == 1) ; no `n at the end if only 1 file was selected { temp := origNameArray%A_Index% } else temp := origNameArray%A_Index% . "`n" continue } if (A_Index == fileCount) ; the last loop, we don't need an extra 'n at the end temp := temp . origNameArray%A_Index% else temp := temp . origNameArray%A_Index% . "`n" } GuiControl,,MyEdit, %MyEdit%%temp% } return ButtonSaveAndClose: Gui, Submit, NoHide errorCount = 0 Loop, PARSE, MyEdit, `n, `r { currentNewName := A_LoopField currentOrigName := origNameArray%A_Index% IfNotExist, %currentOrigName% { errorCount++ continue } FileMove, %currentOrigName%, %currentNewName% if (errorlevel) errorCount++ } fileRenameCount := fileCount - errorCount msgbox %fileRenameCount% file(s) renamed out of %fileCount% ExitApp return