Global Const $RarExeFilePuth = "C:\Program Files\WinRAR\rar.exe"
; Модуль Архивация
Func RAR_AddFiles($Archive, $File, $Compress=3, $DelFilesMode=0, $ExecutePuths=1, $Protect=0, $Password="", $Continuous=0, $SFX="", $Delims=0, $OldDelimsSh=0, $TempDir=@TempDir)
If $DelFilesMode = "0" Then $DelFilesMode=""
If $DelFilesMode = "1" Then $DelFilesMode="-df "
If $DelFilesMode = "2" Then $DelFilesMode="-dr "
If $DelFilesMode = "3" Then $DelFilesMode="-dw "
If $ExecutePuths = "0" Then $ExecutePuths = ""
If $ExecutePuths = "1" Then $ExecutePuths = "-ep "
If $ExecutePuths = "2" Then $ExecutePuths = "-ep1 "
If $ExecutePuths = "3" Then $ExecutePuths = "-ep2 "
If $ExecutePuths = "4" Then $ExecutePuths = "-ep3 "
If $Protect = "0" Then $Password = ""
If $Protect = "1" Then $Password = '-p"'&$Password&'" '
If $Protect = "2" Then $Password = '-hp"'&$Password&'" '
If $Continuous = "0" Then $Continuous = ""
If $Continuous = "1" Then $Continuous = "-s "
If $SFX = "0" OR $SFX = "" Then
$SFX = ""
Else
$SFX = '-sfx"'&$SFX&'" '
EndIF
If $Delims = "0" OR $Delims = "" Then
$Delims = ""
Else
$Delims = "-v"&$Delims&" "
EndIF
If $OldDelimsSh = "0" Then
$OldDelimsSh = ""
Else
$OldDelimsSh = "-vn "
EndIF
If $TempDir = "0" Then
$TempDir='-w"'&@TempDir&'" '
Else
$TempDir='-w"'&$TempDir&'" '
EndIF
$Archive = '-y "'&$Archive&'" '
$File = '"'&$File&'"'
Local $StartCmdLine = $RarExeFilePuth&' a '&$DelFilesMode&$ExecutePuths&$Password&$Continuous&$SFX&$Delims&$OldDelimsSh&$TempDir&$Archive&$File
Return RunWait ($StartCmdLine, @WorkingDir, 0)
EndFunc
; Создание конфига
If Not FileExists (@ScriptDir &"\cfg.ini") Then
$MDir1 = FileSelectFolder ("Укажите путь к папке с ","",7)
$RDir1 = FileSelectFolder ("Укажите путь к папке с ","",7)
IniWrite(@ScriptDir &"\cfg.ini", "MAILEX1", "key1",$MDir1 )
IniWrite(@ScriptDir &"\cfg.ini", "Reestr1", "path1",$RDir1 )
Exit
EndIf
; Чтение конфига
$var1 = IniRead(@ScriptDir &"\cfg.ini", "MAILEX1", "key1", "Not found")
$set1 = IniRead(@ScriptDir &"\cfg.ini", "Reestr1", "path1", "Not found")
$time = @YEAR &("_")& @MON
; получение имени архива
$text1 = FileReadLine ($var1 & "\Stcodes.txt",2)
$pass = "*******"
; Свернуть окна
Send("#m")
; Первый запрос
; Проверка наличия записи в конфиге
If IniReadSection (@ScriptDir &"\cfg.ini", "MAILEX1") Then
Exit
Else
; Запуск программы
ShellExecute($var1 &"\*.exe")
; Выполняемые команды
; Команда архивации
RAR_AddFiles(@DesktopDir &"\"& $text1 &".rar", $set1 &"\*.txt",3,0,1)
; проверка наличия каталога и создание при отсутствии
If DirGetSize ($set1 &"\"& $time) Then
DirCreate ($set1 &"\"& $time)
EndIf
; Перемещение остаточных файлов в резерв
FileMove ($set1 &"\*.txt",$set1 &"\"& $time,1)
EndIf