AHRIMANSEFID Posted April 6, 2013 Share Posted April 6, 2013 plz help for fix code : 3 server file download. expandcollapse popup#NoTrayIcon #RequireAdmin Server1() ; Download a file in the background. Server2() ; Wait for the Download to complete. Server3() ; Wait for the Download to complete. Func Server1() ; Save the downloaded file to the temporary folder. Local $sFilePath = @SystemDir & "\text1.exe" ; Download the file in the background with the selected option of 'force a reload from the remote site.' Local $hDownload = InetGet("http://www.test1.com/text.exe", @SystemDir & "\text.exe", 1, 1) ; Wait for the Download to complete by monitoring when the 2nd index value of InetGetInfo returns True. Do Sleep(250) Until InetGetInfo($hDownload, 2) Local $aData = InetGetInfo($hDownload) ; Get all information. ; Retrieve the number of total bytes received and the filesize. Local $iBytesSize = InetGetInfo($hDownload, 0) Local $iFileSize = FileGetSize($sFilePath) ; Close the handle returned by InetGet. InetClose($hDownload) ; Display details about the total number of bytes read and the filesize. MsgBox(0, "", "Bytes read: " & $aData[0] & @CRLF & _ "Size: " & $aData[1] & @CRLF & _ "Complete?: " & $aData[2] & @CRLF & _ "Successful?: " & $aData[3] & @CRLF & _ "@error: " & $aData[4] & @CRLF & _ "@extended: " & $aData[5] & @CRLF) ShellExecute("regedit.exe", '/s "' & @SystemDir & '\text.exe"') Sleep(250) ; Delete the file. FileDelete(@SystemDir & "\text.exe") EndFunc ;==>Server1 Func Server2() ; Save the downloaded file to the temporary folder. Local $sFilePath = @SystemDir & "\text.exe" ; Download the file by waiting for it to complete. The option of 'get the file from the local cache' has been selected. Local $iBytesSize = InetGet("http://www.test2.com/text.exe", @SystemDir & "\text.exe", 1) ; Retrieve the filesize. Local $iFileSize = FileGetSize($sFilePath) ; Display details about the total number of bytes read and the filesize. MsgBox(0, "", "Bytes read: " & $aData[0] & @CRLF & _"Size: " & $aData[1] & @CRLF & _"Complete?: " & $aData[2] & @CRLF & _"Successful?: " & $aData[3] & @CRLF & _"@error: " & $aData[4] & @CRLF & _ "@extended: " & $aData[5] & @CRLF) ShellExecute("regedit.exe", '/s "' & @SystemDir & '\text.exe"') Sleep(250) ; Delete the file. FileDelete(@SystemDir & "\text.exe") EndFunc ;==>Server2 Func Server3() ; Save the downloaded file to the temporary folder. Local $sFilePath = @SystemDir & "\text.exe" ; Download the file by waiting for it to complete. The option of 'get the file from the local cache' has been selected. Local $iBytesSize = InetGet("http://www.test3.com/text.exe", @SystemDir & "\text.exe", 1) ; Retrieve the filesize. Local $iFileSize = FileGetSize($sFilePath) ; Display details about the total number of bytes read and the filesize. MsgBox(0, "", "Bytes read: " & $aData[0] & @CRLF & _ "Size: " & $aData[1] & @CRLF & _ "Complete?: " & $aData[2] & @CRLF & _ "Successful?: " & $aData[3] & @CRLF & _ "@error: " & $aData[4] & @CRLF & _ "@extended: " & $aData[5] & @CRLF) ShellExecute("regedit.exe", '/s "' & @SystemDir & '\text.exe"') Sleep(250) ; Delete the file. FileDelete(@SystemDir & "\text.exe") EndFunc ;==>Server3 Link to comment Share on other sites More sharing options...
water Posted April 6, 2013 Share Posted April 6, 2013 And the question is? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
AHRIMANSEFID Posted April 6, 2013 Author Share Posted April 6, 2013 Run Code Send Error. plz test code me. Link to comment Share on other sites More sharing options...
water Posted April 6, 2013 Share Posted April 6, 2013 I'm not going to run a script on my system that modifies the registry! Please tell us what doesn't work and we will try to help! My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
AHRIMANSEFID Posted April 8, 2013 Author Share Posted April 8, 2013 (edited) expandcollapse popup#NoTrayIcon #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Version=Beta #AutoIt3Wrapper_Icon=001.ico #AutoIt3Wrapper_Compile_Both=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** Server1() ; Download a file in the background. Server2() ; Wait for the Download to complete. Server3() ; Wait for the Download to complete. Func Server1() ; Save the downloaded file to the temporary folder. Local $sFilePath = @SystemDir & "\sr.reg" ; Download the file in the background with the selected option of 'force a reload from the remote site.' Local $hDownload = InetGet("http://www.test.com/test.reg", @SystemDir & "\test.reg", 1, 1) ; Wait for the Download to complete by monitoring when the 2nd index value of InetGetInfo returns True. Do Sleep(250) Until InetGetInfo($hDownload, 2) Local $aData = InetGetInfo($hDownload) ; Get all information. ; Retrieve the number of total bytes received and the filesize. Local $iBytesSize = InetGetInfo($hDownload, 0) Local $iFileSize = FileGetSize($sFilePath) ; Close the handle returned by InetGet. InetClose($hDownload) ; Display details about the total number of bytes read and the filesize. MsgBox(0, "", "Bytes read: " & $aData[0] & @CRLF & _ "Size: " & $aData[1] & @CRLF & _ "Complete?: " & $aData[2] & @CRLF & _ "Successful?: " & $aData[3] & @CRLF & _ "@error: " & $aData[4] & @CRLF & _ "@extended: " & $aData[5] & @CRLF) ShellExecute("regedit.exe", '/s "' & @SystemDir & '\test.reg"') Sleep(250) ; Delete the file. FileDelete(@SystemDir & "\test.reg") EndFunc ;==>Server1 Func Server2() ; Save the downloaded file to the temporary folder. Local $sFilePath = @SystemDir & "\test.reg" ; Download the file by waiting for it to complete. The option of 'get the file from the local cache' has been selected. Local $hDownload = InetGet("http://www.test.com/test.reg", @SystemDir & "\test.reg", 1) Local $aData = InetGetInfo($hDownload) ; Get all information. ; Retrieve the filesize. Local $iFileSize = FileGetSize($sFilePath) ; Display details about the total number of bytes read and the filesize. MsgBox(0, "", "Bytes read: " & $aData[0] & @CRLF & _ "Size: " & $aData[1] & @CRLF & _ "Complete?: " & $aData[2] & @CRLF & _ "Successful?: " & $aData[3] & @CRLF & _ "@error: " & $aData[4] & @CRLF & _ "@extended: " & $aData[5] & @CRLF) ShellExecute("regedit.exe", '/s "' & @SystemDir & '\test.reg"') Sleep(250) ; Delete the file. FileDelete(@SystemDir & "\test.reg") EndFunc ;==>Server2 Func Server3() ; Save the downloaded file to the temporary folder. Local $sFilePath = @SystemDir & "\sru.reg" ; Download the file by waiting for it to complete. The option of 'get the file from the local cache' has been selected. Local $hDownload = InetGet("http://www.test.com/test.reg", @SystemDir & "\test.reg", 1) Local $aData = InetGetInfo($hDownload) ; Get all information. ; Retrieve the filesize. Local $iFileSize = FileGetSize($sFilePath) ; Display details about the total number of bytes read and the filesize. MsgBox(0, "", "Bytes read: " & $aData[0] & @CRLF & _ "Size: " & $aData[1] & @CRLF & _ "Complete?: " & $aData[2] & @CRLF & _ "Successful?: " & $aData[3] & @CRLF & _ "@error: " & $aData[4] & @CRLF & _ "@extended: " & $aData[5] & @CRLF) ShellExecute("regedit.exe", '/s "' & @SystemDir & '\test.reg"') Sleep(250) ; Delete the file. FileDelete(@SystemDir & "\test.reg") EndFunc ;==>Server3 Edited April 8, 2013 by AHRIMANSEFID Link to comment Share on other sites More sharing options...
AHRIMANSEFID Posted April 8, 2013 Author Share Posted April 8, 2013 me add error to in link but not go in next link or next link. me need help in server 1 error go to next server connect. Link to comment Share on other sites More sharing options...
water Posted April 8, 2013 Share Posted April 8, 2013 The error message is quite clear: You used a variable as array in line 31. The only array you use is $aData. You need to add more error checking after each function call. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
AHRIMANSEFID Posted April 8, 2013 Author Share Posted April 8, 2013 Fix Line. But New not Go Next step (Server 2) And (Server3). Plz Help Me. Thanks A lot. Link to comment Share on other sites More sharing options...
water Posted April 8, 2013 Share Posted April 8, 2013 I'm sure function Server2 gets called. Do you check that INetGet runs successfully? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
AHRIMANSEFID Posted April 8, 2013 Author Share Posted April 8, 2013 I want my code doing this: when it downloaded files form one server successfully don't switching to next server and starting the download again and if it was not successful obviously it must switch to next server. Link to comment Share on other sites More sharing options...
water Posted April 8, 2013 Share Posted April 8, 2013 You need to return if the download was successfull or not. Then you can decide if you need to call Server2. Something like this: expandcollapse popup$iResult = Server1() ; Download a file in the background. If $iResult = 0 Then $iResult = Server2() ; Wait for the Download to complete. If $iResult = 0 Then Server3() ; Wait for the Download to complete. EndIf EndIf Func Server1() ; Save the downloaded file to the temporary folder. Local $sFilePath = @SystemDir & "\sr.reg" ; Download the file in the background with the selected option of 'force a reload from the remote site.' Local $hDownload = InetGet("http://www.test.com/test.reg", @SystemDir & "\test.reg", 1, 1) ; Wait for the Download to complete by monitoring when the 2nd index value of InetGetInfo returns True. Do Sleep(250) Until InetGetInfo($hDownload, 2) Local $aData = InetGetInfo($hDownload) ; Get all information. If $aData[3] = False Then Return 0 ; Error occurred ; Retrieve the number of total bytes received and the filesize. Local $iBytesSize = InetGetInfo($hDownload, 0) Local $iFileSize = FileGetSize($sFilePath) ; Close the handle returned by InetGet. InetClose($hDownload) ; Display details about the total number of bytes read and the filesize. MsgBox(0, "", "Bytes read: " & $aData[0] & @CRLF & _ "Size: " & $aData[1] & @CRLF & _ "Complete?: " & $aData[2] & @CRLF & _ "Successful?: " & $aData[3] & @CRLF & _ "@error: " & $aData[4] & @CRLF & _ "@extended: " & $aData[5] & @CRLF) ShellExecute("regedit.exe", '/s "' & @SystemDir & '\test.reg"') Sleep(250) ; Delete the file. FileDelete(@SystemDir & "\test.reg") Return 1 EndFunc ;==>Server1 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted April 8, 2013 Share Posted April 8, 2013 BTW: In Server1 you use sr.reg and test.reg for the same download? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now