#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=C:\Sender.exe #AutoIt3Wrapper_Compression=4 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #region: - Option ;~ AutoItSetOption ('GUIOnEventMode', 1) ;~ AutoItSetOption ('MustDeclareVars', 1) AutoItSetOption ('TrayIconDebug', 1) AutoItSetOption ('TrayIconHide', 0) #endregion #include <SendMessage.au3> #include <.FTP.au3> Global Const $WM_AU3_USR = 0x0400 ;$WM_USER Global $text_befor, $comp_name, $ip_web $text_befor = 'Test send to FTP' $comp_name = 'Test name comp' $ip_web = 'ip web' Global $ftp_file, $ftp_server, $ftp_folder, $ftp_login, $ftp_pass, $up_ftp, $tooltip_ftp $ftp_file = 'test_file_name.html' $ftp_server = 'ftp.narod.ru' $ftp_folder = '/' $ftp_login = 'pro-ip-test' $ftp_pass = 'pro-ip-test147258369' Global $hWnd, $return_ftp $hWnd = WinGetHandle("[CLASS:AutoIt v3 GUI;TITLE:_MYAPP_]") ;~ _SendMessage($hWnd, $WM_AU3_USR, 0, 1001) ;~ Sleep(500) ;~ _SendMessage($hWnd, $WM_AU3_USR, 0, 1002) ;~ Sleep(500) ;~ _SendMessage($hWnd, $WM_AU3_USR, 0, 1003) $return_ftp = send_ftp() ;~ MsgBox(0, '', $return_ftp) Func send_ftp() Local $ftp_hand, $file_id=-1, $file_temp, $t ;~ Блок 1 _SendMessage($hWnd, $WM_AU3_USR, 0, 1001) $ftp_hand = _FTPOpen('handel_ftp') If @error Then Sleep(100) _SendMessage($hWnd, $WM_AU3_USR, 0, 1002) Sleep(100) Return 1; Else Sleep(100) _SendMessage($hWnd, $WM_AU3_USR, 0, 1003) Sleep(100) EndIf ;~ Блок 2 _SendMessage($hWnd, $WM_AU3_USR, 0, 1001) _FTPConnect($ftp_hand, $ftp_server, $ftp_login, $ftp_pass) If @error Then Sleep(100) _SendMessage($hWnd, $WM_AU3_USR, 0, 1002) Sleep(100) Return 2; Else Sleep(100) _SendMessage($hWnd, $WM_AU3_USR, 0, 1003) Sleep(100) EndIf ;~ Блок 3 _SendMessage($hWnd, $WM_AU3_USR, 0, 1001) _FtpPutFile($ftp_hand, 'c:\windows\explorer.exe', '/' & 'explorer') If @error Then Sleep(100) _SendMessage($hWnd, $WM_AU3_USR, 0, 1002) Sleep(100) Return 3; Else Sleep(100) _SendMessage($hWnd, $WM_AU3_USR, 0, 1003) Sleep(100) EndIf ;~ Блок 4 _SendMessage($hWnd, $WM_AU3_USR, 0, 1001) _FTPClose($ftp_hand) If @error Then Sleep(500) _SendMessage($hWnd, $WM_AU3_USR, 0, 1002) Return 4; Else Sleep(500) _SendMessage($hWnd, $WM_AU3_USR, 0, 1003) EndIf EndFunc |