Bert Posted February 20, 2008 Share Posted February 20, 2008 (edited) 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 February 20, 2008 by Volly The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
DaleHohm Posted February 20, 2008 Share Posted February 20, 2008 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 More sharing options...
Bert Posted February 21, 2008 Author Share Posted February 21, 2008 Dale, you are a genius! That will do the trick nicely. Thanks! The Vollatran project My blog: http://www.vollysinterestingshit.com/ 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