virushandsome Posted December 13, 2014 Posted December 13, 2014 (edited) I used _IEBodyReadHTML to read website, delay 5 second. This script run OK, but sometimes I get this error I checked code in IE.au3, Line 1940, this line is Returns HTML included in the body of the docuement, I found no mistake here. My problem is: 1. What can I do to by pass this error? 2. Whenever I get this error, my auto can't run continuous. If the website change on this time, I will missing. Can I set this error to exceptions? 3. Can I auto close this error and reopen the script to keep my auto run continuous. #include <IE.au3> ReadWeb() Func ReadWeb() While 1 $Url = "http://www.autoitscript.com/" $oIE = _IECreate($Url, 1) $html = _IEBodyReadHTML($oIE) ConsoleWrite("string: " & $html & @CRLF) Sleep(100) WinClose("[REGEXPTITLE:.*- Windows Internet Explorer]") Sleep(5000) WEnd EndFunc Edited January 9, 2015 by virushandsome
MikahS Posted December 26, 2014 Posted December 26, 2014 For one, what is the error you are recieving? As, all I see is you might have tried to attach a picture and it didn't seem to work. Two, if you don't already have an IE window open when you start this script you will get this error: --> IE.au3 T3.0-1 Warning from function _IEAttach, $_IESTATUS_NoMatch That is because of this: $oIE = _IECreate($Url, 1) ;<<<<<<<<<<<<<<<< The 1 param tries to attach to an existing window, which will throw this error ^^^^ By changing it to: $oIE = _IECreate($Url) you will not get this error. Anything else I can help with? Snips & Scripts Reveal hidden contents My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
virushandsome Posted January 9, 2015 Author Posted January 9, 2015 On 12/26/2014 at 2:04 PM, MikahS said: For one, what is the error you are recieving? As, all I see is you might have tried to attach a picture and it didn't seem to work. Two, if you don't already have an IE window open when you start this script you will get this error: --> IE.au3 T3.0-1 Warning from function _IEAttach, $_IESTATUS_NoMatch That is because of this: $oIE = _IECreate($Url, 1) ;<<<<<<<<<<<<<<<< The 1 param tries to attach to an existing window, which will throw this error ^^^^ By changing it to: $oIE = _IECreate($Url) you will not get this error. Anything else I can help with? Sorry, I reupload the error picture. My script don't has the error you said. Anyway, thank you! I still wait for help!
Danp2 Posted January 9, 2015 Posted January 9, 2015 Have you tried using _IEQuit instead of WinClose? Latest Webdriver UDF Release Webdriver Wiki FAQs
Sodori Posted January 9, 2015 Posted January 9, 2015 (edited) As Danp2 pointed out; ReadWeb() Func ReadWeb() While 1 $Url = "http://www.autoitscript.com/" $oIE = _IECreate($Url, 1) $html = _IEBodyReadHTML($oIE) ConsoleWrite("string: " & $html & @CRLF) Sleep(100) _IEQuit($oIE) ;Changed from WinClose to _IEQuit Sleep(5000) WEnd EndFunc Else it's a nightmare to bug as you will have a billion million windows xD Second of all, I don't seem to be able to reproduce your error ran it for a good while. Thirdly, I strongly suggest you run it in SciTE so that you get a command console with said error and it should be easier to at least flush out what line is the trouble maker. Fourthly, I take it this is just some example/learning code? Why direct to a function, when it's just going to loop? The function is so obsolete it makes my skin turn zebra pattern xD.. all do respect ^^ EDIT: Come to think of it, as you say it's now and then after it's been run for a while. Is it because the process list is clogged with "iexplorer.exe" because your program does not shut them down properly? It's a vague long shot, and highly probably faulty. But I digress. Edited January 9, 2015 by Sodori
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