MrPinkComputerShrink Posted October 2, 2014 Posted October 2, 2014 Pretty simple. I need a setting or a loop to kick out of one of these commands if they do not return the data on 2,4,7 seconds. #include <IE.au3> #include <Inet.au3> ;Pretty simple. Local $UnitName = BinaryToString(InetRead('https://www.autoitscript.com/site/autoit/' 1)) If @error <> 0 Then ConsoleWrite("_INetRead did not return. " & @CRLF) EndIf ;~ or ;~ Local $UnitName = (_INetGetSource('https://www.autoitscript.com/site/autoit/' 1)) ;~ If @error <> 0 Then ;~ ConsoleWrite("_INetGetSource did not return. " & @CRLF) ;~ EndIf ConsoleWrite("_INetGetSource " & $UnitName & @CRLF) Thanks in advance inetgetpoo.au3
MrPinkComputerShrink Posted October 2, 2014 Author Posted October 2, 2014 (edited) A way to call multiple InetRead or _INetGetSource simultaneously would be super helpful as well. I am actually pulling data from multiple similar devices on a single subnet. The devices usually respond to their http: requests almost instantly. When they don't, that http: data can take 10 to 30 seconds. I've found if I just hit them with the same command a second after I don't get a response about 80% of the tme, the units respond instantly. If I could send a InetRead or _INetGetSource, wait 1 second for response then send another immediately if not response is received thsi would minutes off a process that should take seconds. Edited October 2, 2014 by MrPinkComputerShrink
jguinch Posted October 2, 2014 Posted October 2, 2014 Maybe this can help you : '?do=embed' frameborder='0' data-embedContent>> Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
Solution MrPinkComputerShrink Posted October 2, 2014 Author Solution Posted October 2, 2014 Got it... from another post about this same thing. Newbie I am. func _inetread_timeout($URL, $HTLM) ;msgbox (0, "$URL $IP" , $URL & " " & $IP) dim $Timer,$PID,$initread_server,$chars,$timer_result,$timeout_server=1 ;second filedelete(@tempdir&"\initread.txt") $Timer = TimerInit() $PID = Run(@AutoItexe & ' /AutoIt3ExecuteLine "filewrite(@tempdir&''\initread.txt'',inetread(''' & $URL & ''',1))"',"",@SW_HIDE) While 1 If $pid=0 or TimerDiff($Timer)/1000 >= $timeout_server Then $timer_result=TimerDiff($Timer) ProcessClose($PID) msgbox(48,"Error","timeout = "&$timer_result) ElseIf FileExists(@tempdir&"\initread.txt") and not ProcessExists($PID) then $timer_result=TimerDiff($Timer) $chars=fileread(@tempdir&"\initread.txt") filedelete(@tempdir&"\initread.txt") ;consolewrite ("timeout = " & $timer_result & @CRLF & $chars & @CRLF) $HTML = $chars ; msgbox(64,"timeout = "&$timer_result,$chars) Else continueloop EndIf exitloop WEnd Return $HTML endfunc
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