Jump to content

_IEBodyReadHTML. Object errors.


AzKay
 Share

Recommended Posts

#include <IE.au3>
Global $Gold

$InputBox = InputBox("Gold:", "Bot until * gold obtained. [ Leave blank for infinite ]")
If $InputBox = 1 Then
    MsgBox(0, "Error", "Oooops, You pressed cancel!, Exiting...")
    Exit
EndIf
ToolTip("Please wait, Loading gold meter.", 0, 0)
$oIE = _IECreate("http://www.gaiaonline.com", 0, 1, 0)
$oHandle = WinGetHandle("Microsoft Internet Explorer")
If @Error Then MsgBox(0, "", "Handle: " & @error)
_IELoadWait($oIE)
AdlibEnable("_Check")
$ThreadURL = "http://www.gaiaonline.com/guilds/viewtopic.php?t=5756167"
$EditButtonURL = "http://graphics.gaiaonline.com/images/posts/btn_edit.gif"
$PollName = "Bump"
$PollOption = "Bump"
$Sleep = 25000

If $InputBox = "0" Or $InputBox = "" Then
    _Infinite()
Else
    _Finite()
EndIf

Func _Infinite()
While 1
    _GaiaPoll($oIE, $ThreadURL, $EditButtonURL, $PollName, $PollOption, $Sleep)
WEnd
EndFunc

Func _Finite()
Do
    _GaiaPoll($oIE, $ThreadURL, $EditButtonURL, $PollName, $PollOption, $Sleep)
Until $Gold = $InputBox
EndFunc

 Func _GaiaPoll($Object, $ThreadURL, $EditButtonURL, $PollName, $PollOption, $Sleep)
        _IENavigate($Object,$ThreadURL)
        _IEImgClick($Object, $EditButtonURL)
        $Form1 = _IEFormGetObjByName($Object,"post")
        $RemovePoll = _IEFormElementGetObjByName($Form1,"delpollbtn")
        _IEAction($RemovePoll,"click")
        _IELoadWait($Object)
        $Form2 = _IEFormGetObjByName($Object,"post")
        $Poll_Title = _IEFormElementGetObjByName($Form2,"poll_title")
        $Poll_Option = _IEFormElementGetObjByName($Form2,"add_poll_option_text")
        _IEFormElementSetValue($Poll_Title, $PollName)
        _IEFormElementSetValue($Poll_Option, $PollOption)
        _IEFormImageClick ($Form2,"Submit","alt")
        _IELoadWait($Form2, 500)
        _IENavigate($Object, $ThreadURL)
        $Poll = $Object.document.forms(0)
        $Radio = _IEFormElementGetObjByName($Poll, "vote_id")
        $Submit = _IEFormElementGetObjByName($Poll, "submit")
        _IEAction($Radio,"click")
        _IEAction($Submit,"click")
        Sleep($Sleep)
EndFunc
    
Func _StringBetween($s, $from, $to)
$x = StringInStr($s, $from) + StringLen($from)
$y = StringInStr(StringTrimLeft($s, $x), $to)
Return StringMid($s, $x, $y)
EndFunc

Func _Check()
    _Gold()
    _WinExists()
EndFunc

Func _WinExists()
If Not WinExists($oHandle) Then
    MsgBox(0, "Error", "Oooops, IE window has been closed. Exiting...")
    Exit
EndIf
EndFunc

Func _Gold()
If $InputBox = "" Then
    $Source = _IEBodyReadHTML($oIE)
    If Not @Error Then
    $Gold = _StringBetween($Source, "Gold: ", "</p>")
    ToolTip("Gold: " & $Gold & "/Infinite", 0, 0)
    EndIf
ElseIf $InputBox = Not "" Then
    $Source = _IEBodyReadHTML($oIE)
    If Not @Error Then
    $Gold = _StringBetween($Source, "Gold: ", "</p>")
    If $InputBox < $Gold Then
        MsgBox(0, "Error", "Oooops, You already have over the desired ammount!")
        Exit
    EndIf
    ToolTip("Gold: " & $Gold & "/" & $InputBox, 0, 0)
    EndIf
EndIf
EndFunc

Well, Ive had this problem before, But I never seemed to be able to fix it.

Randomly, It gets the "$oIE has to be an object" error. Its annoying, I thought adding the @Error checking, thinking it would fix it, but no avail.

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

Exact error message and your analysis of where in your code this occurs and under what circumstances is required.

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

Exact error message and your analysis of where in your code this occurs and under what circumstances is required.

Dale

Damn, Sorry, I changed the script, now it works fine, Let me remember

The error was "The requested object has failed" Or along those lines, And, the error happened in the

_Gold, $Source, Under "$oIE.body.innertext", I think thats what it was, or .document.body.innertext, Something around those lines.

EDIT::

Silly me, The script is in my first post, Haha, Ill just run it to find my error.

EDIT::

Odd, The error seems to have dissapeared.

Edited by AzKay
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
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...