#NoTrayIcon
#Include <EditConstants.au3>
#Include <GUIConstantsEx.au3>
#Include "Copy.au3"
;--------------------------------------------------------------------------------------------------------------------------------------------------------
Opt('MustDeclareVars', 1)
Opt('TrayAutoPause', 0)
;--------------------------------------------------------------------------------------------------------------------------------------------------------
Global $hForm, $Input1, $Input2, $Button1, $Button2, $Button3, $Button4, $Data, $Msg, $Path, $Progress, $State, $Copy = False, $Pause = False
Global $Source = ' ', $Destination = ' '
;--------------------------------------------------------------------------------------------------------------------------------------------------------
If Not _Copy_OpenDll() Then
MsgBox(16, '', 'Не найдена библиотека *.dll')
Exit
EndIf
;--------------------------------------------------------------------------------------------------------------------------------------------------------
If $CmdLine[0] = "" Then
MsgBox(64, "Сообщение", "Запуск произведен без параметров, приложение будет закрыто.", 10)
Exit
EndIf
For $i=1 to 2
$t=$i*2-1
;-----------------------------------------------------
If $CmdLine[$t] = "-o1" Then
$Source = $CmdLine[$t+1]
EndIf
;-----------------------------------------------------
If $CmdLine[$t] = "-o2" Then
$Destination = $CmdLine[$t+1]
EndIf
Next
;--------------------------------------------------------------------------------------------------------------------------------------------------------
$hForm = GUICreate('Копирование', 360, 163)
$Progress = GUICtrlCreateProgress(14, 94, 332, 16)
;--------------------------------------------------------------------------------------------------------------------------------------------------------
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState()
;--------------------------------------------------------------------------------------------------------------------------------------------------------
While 1
If $Copy Then
$State = _Copy_GetState()
If $State[0] Then
$Data = Round($State[1] / $State[2] * 100)
If GUICtrlRead($Progress) <> $Data Then
GUICtrlSetData($Progress, $Data)
EndIf
Else
Switch $State[5]
Case 0
GUICtrlSetData($Progress, 100)
MsgBox(64, '', 'Файл был успешно скопирован.', 0, $hForm)
Case 1235
MsgBox(16, '', 'Операция прервана.', 0, $hForm)
Case Else
MsgBox(16, '', 'Файл не был скопирован.' & @CR & @CR & $State[5], 0, $hForm)
Exit
EndSwitch
GUICtrlSetData($Progress, 0)
GUICtrlSetData($Button3, 'Копировать')
GUICtrlSetData($Button4, ';')
$Copy = 0
EndIf
EndIf
;--------------------------------------------------------------------------------------------------------------------------------------------------------
_Copy_CopyFile($Source, $Destination)
$Copy = 1
;--------------------------------------------------------------------------------------------------------------------------------------------------------
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
;--------------------------------------------------------------------------------------------------------------------------------------------------------