#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=C:\Put to FTP Module.exe #AutoIt3Wrapper_Compression=4 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #region: - Option AutoItSetOption ('GUIOnEventMode', 1) AutoItSetOption ('MustDeclareVars', 1) AutoItSetOption ('TrayIconDebug', 1) AutoItSetOption ('TrayIconHide', 0) AutoItSetOption ('WinDetectHiddenText', 1) #endregion #region: - Include ;~ #include <ButtonConstants.au3> ;~ #include <ComboConstants.au3> ;~ #include <Constants.au3> ;~ #Include <Date.au3> #include <EditConstants.au3> #include <.FTP.au3> #include <GuiConstantsEx.au3> ;~ #include <GUICtrlSetOnHover_UDF.au3> ;~ #include <GuiIPAddress.au3> ;~ #include <GuiListBox.au3> ;~ #include <GuiListView.au3> ;~ #include <GuiSlider.au3> ;~ #include <GuiStatusBar.au3> ;~ #Include <GuiTab.au3> ;~ #include <GuiToolbar.au3> ;~ #include <inet.au3> ;~ #include <ListBoxConstants.au3> ;~ #include <ListViewConstants.au3> ;~ #include <Registry_UDFs.au3> ;~ #include <_SMTP_Mail.au3> ;~ #Include <StaticConstants.au3> ;~ #Include <TabConstants.au3> #include <WindowsConstants.au3> #endregion Global $win_main, $win_main_title, $name_module_file, $process, $result, $result_end $win_main_title = 'Put to FTP Module' $name_module_file = 'Put to FTP Module.exe' Global $ftp_server, $ftp_login, $ftp_pass, $up_ftp, $tooltip_ftp, $ftp_file_local, $ftp_folder, $ftp_file_ftp $ftp_server = 'ftp.narod.ru' $ftp_login = 'pro-ip-test' $ftp_pass = 'pro-ip-test147258369' $ftp_file_local = 'c:\boot.ini' $ftp_folder = '/' $ftp_file_ftp = 'booot3' ;~ Чтение параметров коммандной строки $ftp_server = $CmdLine[1] $ftp_login = $CmdLine[2] $ftp_pass = $CmdLine[3] $ftp_file_local = $CmdLine[4] $ftp_file_ftp = $CmdLine[5] $win_main = GUICreate($win_main_title, 400, 400, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, '_Exit_pro') GUICtrlCreateLabel('Последнее сообщение выполняемой операции:', 10, 10, 350, 20) $process = GUICtrlCreateEdit('', 10, 30, 380, 250, $ES_MULTILINE + $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_READONLY) GUICtrlCreateLabel('Последнее сообщение результата выполненной операции:', 10, 300, 350, 20) $result = GUICtrlCreateEdit('', 10, 320, 380, 50, $ES_MULTILINE + $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_READONLY) #region: - После создания GUI ;~ GUISetState(@SW_SHOW, $win_main) GUISetState(@SW_HIDE, $win_main) $result_end = _Put_to_FTP() #endregion If $result_end == 0 Then Sleep(100) GUICtrlSetData($process, 'Передача файла на FTP завершенна') GUICtrlSetData($result, 'ОК') Sleep(100) Else Sleep(100) GUICtrlSetData($process, 'Передача файла на FTP завершенна') GUICtrlSetData($result, 'Ошибка в блоке ' & $result_end) Sleep(100) EndIf Sleep(100) GUICtrlSetData($process, '<stop_read_log>') Sleep(100) _Exit_pro() ;~ MsgBox(0, '', ControlGetText($win_main_title, 'Последнее сообщение выполняемой операции:', 'Edit1')) ;~ MsgBox(0, '', ProcessExists($name_module_file)) ;~ MsgBox(0, '', WinGetState($win_main_title)) ;~ Exit While 1 Sleep(100) ;~ ToolTip('WinGetState окна Put to FTP Module:' & @TAB & WinGetState($win_main_title), 10, 70) WEnd Func _Exit_pro() GUICtrlSetData($process, '<stop_read_log>') Exit EndFunc Func _Put_to_FTP() Local $ftp_hand ;~ Блок 1 GUICtrlSetData($process, 'Открытие FTP...') GUICtrlSetData($result, '') Sleep(100) $ftp_hand = _FTPOpen('handel_ftp') If @error Then GUICtrlSetData($result, 'Ошибка (' & @error & ')') Return 1 Else GUICtrlSetData($result, 'ОК') EndIf ;~ Блок 2 Sleep(100) GUICtrlSetData($process, 'Подключение к FTP, сервер: "' & $ftp_server & '", логин: "' & $ftp_login & '", пароль: "' & $ftp_pass & '"') GUICtrlSetData($result, '') Sleep(100) _FTPConnect($ftp_hand, $ftp_server, $ftp_login, $ftp_pass) If @error Then GUICtrlSetData($result, 'Ошибка (' & @error & ')') Return 2 Else GUICtrlSetData($result, 'ОК') EndIf ;~ Блок 3 Sleep(100) GUICtrlSetData($process, 'Отправка файла на FTP, полный путь к локальному файлу: "' & $ftp_file_local & '", полный путь к файлу на FTP: "' & $ftp_folder & $ftp_file_ftp & '"') GUICtrlSetData($result, '') Sleep(100) _FtpPutFile($ftp_hand, $ftp_file_local, $ftp_folder & $ftp_file_ftp) If @error Then GUICtrlSetData($result, 'Ошибка (' & @error & ')') Return 3 Else GUICtrlSetData($result, 'ОК') EndIf ;~ Блок 4 Sleep(100) GUICtrlSetData($process, 'Закрытие FTP соединения') GUICtrlSetData($result, '') Sleep(100) _FTPClose($ftp_hand) If @error Then GUICtrlSetData($result, 'Ошибка (' & @error & ')') Return 4 Else GUICtrlSetData($result, 'ОК') EndIf Return 0 EndFunc |