Sign in to follow this  
Followers 0
autoitxp

_IEBodyReadHTML .innerHTML Error

4 posts in this topic

#1 ·  Posted (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?

#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 by autoitxp

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by autoitxp

Share this post


Link to post
Share on other sites

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

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