Sign in to follow this  
Followers 0
virushandsome

_IEBodyReadHTML sometimes get Error

6 posts in this topic

#1 ·  Posted (edited)

I used _IEBodyReadHTML to read website, delay 5 second. This script run OK, but sometimes I get this error

autoit1.jpg

Lrs.jpg

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 by virushandsome

Share this post


Link to post
Share on other sites



Anyone solved this?

Share this post


Link to post
Share on other sites

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


My Snips: graphCPUTemp ~ getENVvars
My 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

 

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

Have you tried using _IEQuit instead of WinClose?

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by Sodori

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0