Jump to content

_IEbodyReadtext


Bert
 Share

Recommended Posts

Here is my code:

func _depotMD()
    $oIE = _IECreate("http://www.xxxxxxxxxxxxxxxxxx.com", 0,1)
    $page = _IEbodyReadtext($oIE)
    $sIs1 = StringInStr($page,"Server Login")   
    if $sIs1 > 1 then 
        sleep(100)
        _IEAction($oIE, "visible")  
        
        Do
            sleep(100)
            $page = _IEbodyReadtext($oIE)
            if $page = -1 then sleep(1)
            $sIs1 = StringInStr($page,"Orders\By Person")
            $sIs2 = StringInStr($page,"authorized")
        until $sIs1 > 1  or $sIs2 = 36
        
        if $sIs1 > 1 then           
            _depotMDB()
        endif   
        if $sIs2 > 1 then 
            _IEQuit($oIE)
            MsgBox(48, "Authorzation Required!", "You are not authorized to access the Depot website.", 5)
        endif   
    endif
EndFunc

I'm using this method to see if one of 2 pages comes up when someone tries to access a website. My problem is when the page is in transition in the Do loop, _IEbodyReadtext will sometimes cause a crash of my script:

C:\Program Files\AutoIt3\Include\IE.au3 (2143) : ==> Variable must be of type "Object".:

Return $o_object.document.body.innerText

Return $o_object.document.body^ ERROR

I can change the delay to 500 on the last line, but that still leaves the possiblity of a crash. What would be a good way to check to see which one oif the 2 pages I'm on the lookout for show up?

I tried putting after the _IEbodyReadText a error check. - If $page = -1 then sleep(1). Didn't work

Edited by Volly
Link to comment
Share on other sites

Put _IELoadWait($oIE) just before the _IEBodyReadText

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...