autoitxp Posted December 6, 2007 Share Posted December 6, 2007 (edited) Hi This code some time give error .innerHTML and application get ended with -1 error i think its _IEBodyReadHTML realted error can any figure out wat is wrong in this code? expandcollapse popup#include <GUIConstants.au3> #include <Misc.au3> #include <IE.au3> Local $sTexts GUICreate("_IE") GUISetState (@SW_SHOW) $dll = DllOpen("user32.dll") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case _IsPressed("01", $dll) _IE() Case _IsPressed("0D", $dll) _IE() EndSelect Wend Func _IE() $window = WinGetTitle("") $len = StringTrimRight($window, 30) $oIE = _IEAttach($len) $sTexts = _IEBodyReadHTML($oIE) if @error = 0 then $oForm = _IEFormGetCollection($oIE, 0) If @error Then Else $colElem = _IEFormElementGetCollection($oForm) If @error Then Else $iElemCnt = @extended $sMsg = "Element values:" & @CRLF $i = 0 For $oElem In $colElem $sMsg &= $i & ": " & _IEFormElementGetValue($oElem) & @CRLF $i += 1 Next MsgBox(64, $iElemCnt & " Results", $sMsg) EndIf EndIf EndIf EndFunc DllClose($dll) Edited December 6, 2007 by autoitxp Link to comment Share on other sites More sharing options...
DaleHohm Posted December 6, 2007 Share Posted December 6, 2007 First, insure you are running this from SciTe and include the messages generated during the program run when you ask for help like this. Second, you need to understand that a Window Title and a Document Title are not the same thing. The document title is controlled by the <TITLE> tag in a document. An IE Window Title typically is a Document Title with a fixed string appended - like "- Microsoft Internet Explorer". _IEAttach offers a "windowtitle" mode in addition to the default "title" mode. Again, please study the messages that that IE.au3 generates to the SciTe console -- a lot of work went into making them helpful. 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...
autoitxp Posted December 6, 2007 Author Share Posted December 6, 2007 (edited) Hi here is Nasty Error im getting while running above script and Standalone App Ended With -1 error code SciTe Generated: C:\Program Files\AutoIt3\Include\IE.au3 (2112) : ==> Variable must be of type "Object".: Return $o_object.document.body.innerHTML Return $o_object.document.body^ ERROR Above script is not more then 100 lines offcourse its in IE.au3 line (2112) Edited December 6, 2007 by autoitxp Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 6, 2007 Share Posted December 6, 2007 Hi here is Nasty Error im getting while running above script and Standalone App Ended With -1 error code SciTe Generated: C:\Program Files\AutoIt3\Include\IE.au3 (2112) : ==> Variable must be of type "Object".: Return $o_object.document.body.innerHTML Return $o_object.document.body^ ERROR Above script is not more then 100 lines offcourse its in IE.au3 line (2112) This is a particularly ugly way to attach to IE: $window = WinGetTitle("") $len = StringTrimRight($window, 30) $oIE = _IEAttach($len) $sTexts = _IEBodyReadHTML($oIE) You might be trying to do _IEBodyReadHTML() before the DOM is ready. Throw in an _IELoadWait(): $window = WinGetTitle("") $len = StringTrimRight($window, 30) $oIE = _IEAttach($len) _IELoadWait($oIE) $sTexts = _IEBodyReadHTML($oIE) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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