Jdop Posted July 3, 2014 Share Posted July 3, 2014 (edited) I have a fairly complex (too big to post here) program that loads and scans web pages looking for changes in the content. Been running it for years. I made no changes to the code, and no changes to my computer that should have an impact on using an embedded IE within autoit. Code just stopped working, and I've traced it to the _IEDocWriteHTML routine (found in the IE.au3 include), which is acting like a black hole, not throwing an error, but not returning properly and allowing the program to resume. I realize this is little to go on, but maybe someone else has seen this behavioir. My code gets to just before the _IEDocWriteHTML call, prints "line 340" , and never exits to print "line 342". Just hangs. Tired it with a few diff websites, all fail. I'm thinking some IE setting got changed somehow. ConsoleWrite("line 340" & @LF) _IEDocWriteHTML($oIE, $mHTML) ConsoleWrite("line 342" & @LF) Update; One page EVENTUALLY comes out of that function , but only after a few MINUTES!. It should be instantaneous. Getting better: After about 6 minutes got this: IE.au3 T3.0-1 Warning from function _IELoadWait, $_IESTATUS_LoadWaitTimeout What could be causing the page to fail? loads instantaneously in an IE browser. Here's the url , its an rss feed http://us.spindices.com/rss/rss-details/?rssFeedName=us-equity Again, this is code that has worked for years with few hiccups. I updated to the latest Autoit Build just to see if that would make a diff, but it didnt =============================================================================================================================== Windows 7 X64 Edited July 3, 2014 by Jdop Link to comment Share on other sites More sharing options...
Jdop Posted July 4, 2014 Author Share Posted July 4, 2014 I'm having trouble seeing any of the replies. Must be the same issue I'm having with the code. Link to comment Share on other sites More sharing options...
Jdop Posted July 7, 2014 Author Share Posted July 7, 2014 That was it! Thanks Link to comment Share on other sites More sharing options...
mikell Posted July 7, 2014 Share Posted July 7, 2014 The replies are closely linked to the amount of code you posted allowing to efficiently reproduce the problem Link to comment Share on other sites More sharing options...
Jdop Posted July 7, 2014 Author Share Posted July 7, 2014 The replies are closely linked to the amount of code you posted allowing to efficiently reproduce the problem Yeah I get it. Made no sense this would just stop working. Worked once this am then stopped again when rerun. Told ya, complicated code. I'll reproduce when I get a chance Link to comment Share on other sites More sharing options...
Jdop Posted July 24, 2014 Author Share Posted July 24, 2014 (edited) I have inserted the code thats failing for me in an existing autoit demo , posted here.Starting at line 34, I load a web page, (I am using the same URL here as I do in my problematic code), using InetRead into a string, do a simple manipulation, and then send that string to an embedded IE using IEDocWriteHTML.This is working perfectly and fast in this simple example, but is causing a huge timeout in code that up until recently didn't have the problem. The non working code has a lot more going on, but NOT at this point of failure. The code is the same.The error is >> IE.au3 T3.0-1 Warning from function _IELoadWait, $_IESTATUS_LoadWaitTimeoutNot sure how I get the error in my code , but not in this posted example.Any advice where to start looking for what the problem MIGHT be would be appreciated.My app is 1000 lines long, if someone wants to see it, I'll pass it along. expandcollapse popup#include <GUIConstantsEx.au3> #include <IE.au3> #include <WindowsConstants.au3> Local $oIE = _IECreateEmbedded() GUICreate("Embedded Web control Test", 640, 580, _ (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _ $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) GUICtrlCreateObj($oIE, 10, 40, 600, 360) Local $idButton_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30) Local $idButton_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30) Local $idButton_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30) Local $idButton_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30) Global $g_idError_Message = GUICtrlCreateLabel("", 100, 500, 500, 30) GUICtrlSetColor(-1, 0xff0000) GUISetState(@SW_SHOW) ;Show GUI Local $mHTML="" $url="http://seekingalpha.com/feed.xml" _IENavigate($oIE, $url) ;_IENavigate($oIE, "http://www.autoitscript.com") _IEAction($oIE, "stop") ; Waiting for user to close the window While 1 Local $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE ExitLoop Case $iMsg = $idButton_Home ; >>>>> this is the code thats failing (causing a timeout) in MY app, but not in this test $mHTML = InetRead($url, 1 + 16) $mHTML = BinaryToString($mHTML) ;this next function causes a very long timeout with the following error in my code (not this test version) ; ERROR = IE.au3 T3.0-1 Warning from function _IELoadWait, $_IESTATUS_LoadWaitTimeout _IEDocWriteHTML($oIE, $mHTML) Case $iMsg = $idButton_Back _IEAction($oIE, "back") CheckError("Back", @error, @extended) Case $iMsg = $idButton_Forward _IEAction($oIE, "forward") CheckError("Forward", @error, @extended) Case $iMsg = $idButton_Stop _IEAction($oIE, "stop") CheckError("Stop", @error, @extended) EndSelect WEnd GUIDelete() Exit Func CheckError($sMsg, $iError, $iExtended) ConsoleWrite('@@ (55) :(' & @MIN & ':' & @SEC & ') CheckError()' & @CR) ;### Function Trace If $iError Then $sMsg = "Error using " & $sMsg & " button (" & $iExtended & ")" Else $sMsg = "" EndIf GUICtrlSetData($g_idError_Message, $sMsg) EndFunc ;==>CheckError Edited July 24, 2014 by Jdop Link to comment Share on other sites More sharing options...
Jdop Posted July 25, 2014 Author Share Posted July 25, 2014 Nothing huh.Obviously , the same operation that works cleanly in one setting, is causing a timeout (set by default in ie.au3 to 5 minutes) in another.The question is why. Yes, I feel your pain, I am not posting the code with the error condition.Even odder, I am executing the exact same code EARLIER in the run and it does not timeout.Either I have forgotten how to code after 40 years or Autoit is acting stupid. Link to comment Share on other sites More sharing options...
Jdop Posted July 25, 2014 Author Share Posted July 25, 2014 ok, if this is too hard for the crowd then so be it.everyone has their limits Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 25, 2014 Moderators Share Posted July 25, 2014 Jdop,Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
DaleHohm Posted July 25, 2014 Share Posted July 25, 2014 There is something unique in the content you are writing to the browser that is causing readyState not to make it to Complete (or 4). Does the browser contain the content that you expect it to contain after the _IEDocWriteHTML? If so, you can bypass the intrinsic _IELoadWait in _IEDocWriteHTML by using _IELoadWaitTimeout(0) before your call and _IELoadWaitTimeout(30000) afterwards to reset it to five minutes. 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...
Jdop Posted July 26, 2014 Author Share Posted July 26, 2014 (edited) I will try resetting the timeout to zero and see if that avoids the problem, but no, as I said, the same exact web data is being loaded in the demo code I posted, without any timeout issue.There are only a few lines of code involved, so I'm having a hard time figuring out why the sudden problem. This WAS working for a long time.$mHTML = InetRead($url, 1 + 16)$mHTML = BinaryToString($mHTML)_IEDocWriteHTML($oIE, $mHTML)I mean really, not much room for confusion here. Code works in one setting and not the other.I'm sure there's a reason for this issue but it's quite obscure. Edited July 26, 2014 by Jdop Link to comment Share on other sites More sharing options...
mikell Posted July 26, 2014 Share Posted July 26, 2014 Does the timeout issue still occur if you replace these 3 lines by a _IENavigate($oIE, $url) ? Link to comment Share on other sites More sharing options...
Jdop Posted July 27, 2014 Author Share Posted July 27, 2014 I modified the timeout and yes, that avoids the issue, but doesn't explain why the problem. Stills throws a reported timeout error but appears to be working.I tried mikell's test, and no , loading the url with _IENavigate($oIE, $url) does not produce a timeout.Of course that is a completely different function than injecting the data via the _IEDocWriteHTML($oIE, $mHTML) Link to comment Share on other sites More sharing options...
mikell Posted July 27, 2014 Share Posted July 27, 2014 (edited) Of course it's quite different, I tested this to point at DaleHohm's assumption - something not loaded by InetRead and likely to cause the issue I could't reproduce the timeout issue, but in the code below after clicking the "home" button the console says ReadyState=4 while the page in the control seems to be still 'at work', behavior which is not present if _IENavigate($oIE, $url) is used expandcollapse popup#include <GUIConstantsEx.au3> #include <IE.au3> #include <WindowsConstants.au3> Local $oIE = _IECreateEmbedded() GUICreate("Test", 640, 580, _ (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _ $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) GUICtrlCreateObj($oIE, 10, 40, 600, 360) Local $idButton_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30) Local $idButton_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30) Local $idButton_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30) Local $idButton_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30) Global $g_idError_Message = GUICtrlCreateLabel("", 100, 500, 500, 30) GUICtrlSetColor(-1, 0xff0000) GUISetState(@SW_SHOW) ;Show GUI Local $mHTML="" $url = "http://www.google.com" _IENavigate($oIE, $url) _IEAction($oIE, "stop") While 1 Local $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE ExitLoop Case $iMsg = $idButton_Home ; >>>>> this is the code thats failing (causing a timeout) in MY app, but not in this test $url="http://www.autoitscript.com" ;#cs $mHTML = InetRead($url, 1 + 16) ConsoleWrite("InetRead status OK" & @CR) $mHTML = BinaryToString($mHTML) ConsoleWrite("BinaryToString status OK" & @CR) ;this next function causes a very long timeout with the following error in my code (not this test version) ; ERROR = IE.au3 T3.0-1 Warning from function _IELoadWait, $_IESTATUS_LoadWaitTimeout _IEDocWriteHTML($oIE, $mHTML) ConsoleWrite("_IEDocWriteHTML OK" & @CR) ConsoleWrite("$oIE.ReadyState = " & $oIE.ReadyState & @CR) ConsoleWrite("$oIE.Busy = " & $oIE.Busy & @CR) ;#ce ;_IENavigate($oIE, $url) Case $iMsg = $idButton_Back _IEAction($oIE, "back") CheckError("Back", @error, @extended) Case $iMsg = $idButton_Forward _IEAction($oIE, "forward") CheckError("Forward", @error, @extended) Case $iMsg = $idButton_Stop _IEAction($oIE, "stop") CheckError("Stop", @error, @extended) EndSelect WEnd GUIDelete() Exit Func CheckError($sMsg, $iError, $iExtended) ConsoleWrite('@@ (55) :(' & @MIN & ':' & @SEC & ') CheckError()' & @CR) ;### Function Trace If $iError Then $sMsg = "Error using " & $sMsg & " button (" & $iExtended & ")" Else $sMsg = "" EndIf GUICtrlSetData($g_idError_Message, $sMsg) EndFunc ;==>CheckError Edited July 27, 2014 by mikell Link to comment Share on other sites More sharing options...
Jdop Posted July 29, 2014 Author Share Posted July 29, 2014 On the theory that life is too short to worry about things that have workarounds, I'll not torture over this too much longer 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