#Region
#AutoIt3Wrapper_icon=..\..\..\Мои документы\Web\_Images\AutoIt Black Avatar.ico
#AutoIt3Wrapper_Res_Language=1049
#EndRegion
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Admin\Рабочий стол\AutoIt\opera_ac_backup\backup_opera_AC_0.4.kxf
Global $Opera_Dir = FileSelectFolder("Укажите путь к папке оперы ас", "")
Global $Backup_Dir = $Opera_Dir & "\Op_Backup"
$hMain_GUI = GUICreate("backup_opera_AC", 546, 366, 212, 90)
GUISetIcon($Opera_Dir & "\OperaAC.exe")
GUISetCursor(2)
$First_Checkbox = GUICtrlCreateDummy() + 1
$Checkbox1 = GUICtrlCreateCheckbox("Почта", 40, 40, 81, 25)
$Checkbox2 = GUICtrlCreateCheckbox("Сессии", 40, 70, 81, 25)
$Checkbox3 = GUICtrlCreateCheckbox("Контакты", 40, 100, 81, 25)
$Checkbox4 = GUICtrlCreateCheckbox("Пароли", 40, 130, 81, 25)
$Checkbox5 = GUICtrlCreateCheckbox("Список загрузок", 40, 160, 121, 25)
$Checkbox6 = GUICtrlCreateCheckbox("Глобальная история", 40, 190, 129, 25)
$Checkbox7 = GUICtrlCreateCheckbox("Набранные адреса в адресной строчке", 40, 220, 241, 25)
$Checkbox8 = GUICtrlCreateCheckbox("Поиск", 40, 250, 73, 25)
$Last_Checkbox = GUICtrlCreateDummy() - 1
$Progress1 = GUICtrlCreateProgress(32, 304, 329, 16)
GUICtrlSetColor(-1, 0x008000)
$Button1 = GUICtrlCreateButton("backup", 384, 304, 139, 21, $WS_GROUP)
$Label1 = GUICtrlCreateLabel($Opera_Dir, 40, 20, 492, 17)
$size1 = DirGetSize($Opera_Dir & "\profile\mail")
$size2 = DirGetSize($Opera_Dir & "\profile\sessions")
$size3 = FileGetSize($Opera_Dir & "\profile\contacts.adr")
$size4 = FileGetSize($Opera_Dir & "\profile\wand.dat")
$size5 = FileGetSize($Opera_Dir & "\profile\download.dat")
$size6 = FileGetSize($Opera_Dir & "\profile\mail\global_history.dat")
$size7 = FileGetSize($Opera_Dir & "\profile\mail\typed_history.xml")
$size8 = FileGetSize($Opera_Dir & "\defaults\search.ini")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
DirCreate($Backup_Dir)
$iProgress = 10
$iPrgrs_Step = 100 / (($Last_Checkbox - $First_Checkbox) + 1)
If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
GUICtrlSetData($Progress1, $iProgress)
$iProgress += $iPrgrs_Step
Sleep(3000)
DirCopy($Opera_Dir & "\profile\mail", $Backup_Dir & "\profile\mail")
EndIf
If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then
GUICtrlSetData($Progress1, $iProgress)
$iProgress += $iPrgrs_Step
Sleep(3000)
DirCopy($Opera_Dir & "\profile\sessions", $Backup_Dir & "\profile\sessions")
EndIf
If GUICtrlRead($Checkbox3) = $GUI_CHECKED Then
GUICtrlSetData($Progress1, $iProgress)
$iProgress += $iPrgrs_Step
Sleep(3000)
FileCopy($Opera_Dir & "\profile\contacts.adr", $Backup_Dir & "\profile\")
EndIf
If GUICtrlRead($Checkbox4) = $GUI_CHECKED Then
GUICtrlSetData($Progress1, $iProgress)
$iProgress += $iPrgrs_Step
Sleep(3000)
FileCopy($Opera_Dir & "\profile\wand.dat", $Backup_Dir & "\profile\")
EndIf
If GUICtrlRead($Checkbox5) = $GUI_CHECKED Then
GUICtrlSetData($Progress1, $iProgress)
$iProgress += $iPrgrs_Step
Sleep(3000)
FileCopy($Opera_Dir & "\profile\download.dat", $Backup_Dir & "\profile\")
EndIf
If GUICtrlRead($Checkbox6) = $GUI_CHECKED Then
GUICtrlSetData($Progress1, $iProgress)
$iProgress += $iPrgrs_Step
Sleep(3000)
FileCopy($Opera_Dir & "\profile\global_history.dat", $Backup_Dir & "\profile\")
EndIf
If GUICtrlRead($Checkbox7) = $GUI_CHECKED Then
GUICtrlSetData($Progress1, $iProgress)
$iProgress += $iPrgrs_Step
Sleep(3000)
FileCopy($Opera_Dir & "\profile\typed_history.xml", $Backup_Dir & "\profile\")
EndIf
If GUICtrlRead($Checkbox8) = $GUI_CHECKED Then
GUICtrlSetData($Progress1, $iProgress)
$iProgress += $iPrgrs_Step
Sleep(3000)
FileCopy($Opera_Dir & "\defaults\search.ini", $Backup_Dir & "\profile\")
EndIf
GUICtrlSetData($Progress1, 100)
MsgBox(64, 'Title', 'Копирование успешно завершено.', 0, $hMain_GUI)
GUICtrlSetData($Progress1, 0)
EndSwitch
WEnd