#include <GUIConstantsEx.au3>
#include <File.au3>
$Form2 = GUICreate("Переименование файла", 430, 200, -1, -1)
GUISetBkColor(0x180153)
$Edit1 = GUICtrlCreateEdit("", 10, 10, 410, 150)
$folder = (@ScriptDir & "\Tools")
$btSetEdit = GUICtrlCreateButton("Выбор файла", 10, 165, 100, 30)
$btSetExp = GUICtrlCreateButton("Экспорт", 113, 165, 100, 30)
GUICtrlSetState(-1, $GUI_DISABLE)
$btExit = GUICtrlCreateButton("Выход", 320, 165, 100, 30)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE,$btExit
Exit
Case $btSetEdit
$file = FileOpenDialog('Выберите файл', @ScriptDir & "\Tools\Backup", 'Все файлы (*.*)', 1)
$sText=FileRead($file)
GUICtrlSetData($Edit1, $sText)
If $file Then GUICtrlSetState($btSetExp, $GUI_ENABLE)
Case $btSetExp
$pref = InputBox("Переименование", "Введите префикс имени файла")
$name = StringRegExp($file, "[^\\]+$", 1)
If IsArray($name) Then $name = $name[0]
FileCopy($file, $folder & "\" & $pref & "_" & $name)
$sTextx=('Файл переименован...')
GUICtrlSetData($Edit1, $sTextx)
GUICtrlSetState($btSetExp, $GUI_DISABLE)
EndSwitch
WEnd