Jump to content

Help on Embedded


GRB
 Share

Recommended Posts

Ok here is the code!

#include <IE.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

;Globals
Global $oIE = _IECreateEmbedded()   ;Cria o Internet Explorer Object
Global $URL = "http://ikariam.com.pt/" ;Site
Global $botname = "Ikariam PT Bot"
$oForm = _IEFormGetObjByName ($oIE, "loginForm")
$oName = _IEFormElementGetObjByName ($oForm, "name")

#Region ### START Koda GUI section ### Form=
GUICreate($botname, 1206, 712, -1, -1)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 50, 1186, 612)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$oForm = _IEFormGetObjByName ($oIE, "loginForm")
$oQuery = _IEFormElementGetObjByName ($oForm, "name")

_IENavigate ($oIE, $URL)
_IELoadWait ($oIE)
$oForm = _IEFormGetObjByName ($oIE, "loginForm")
$oName = _IEFormElementGetObjByName ($oForm, "name")
_IEFormElementSetValue ($oName, "mixmax")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

And here is the output!

C:\Programas\AutoIt3\Include\IE.au3 (1247) : ==> Variable must be of type "Object".:

$o_col = $o_object.document.forms.item($s_Name)

$o_col = $o_object.document^ ERROR

Any special reason why im getting this error? Aparently the code is all fine.

GrB

Link to comment
Share on other sites

Ok here is the code!

#include <IE.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

;Globals
Global $oIE = _IECreateEmbedded()   ;Cria o Internet Explorer Object
Global $URL = "http://ikariam.com.pt/" ;Site
Global $botname = "Ikariam PT Bot"
$oForm = _IEFormGetObjByName ($oIE, "loginForm")
$oName = _IEFormElementGetObjByName ($oForm, "name")

#Region ### START Koda GUI section ### Form=
GUICreate($botname, 1206, 712, -1, -1)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 50, 1186, 612)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$oForm = _IEFormGetObjByName ($oIE, "loginForm")
$oQuery = _IEFormElementGetObjByName ($oForm, "name")

_IENavigate ($oIE, $URL)
_IELoadWait ($oIE)
$oForm = _IEFormGetObjByName ($oIE, "loginForm")
$oName = _IEFormElementGetObjByName ($oForm, "name")
_IEFormElementSetValue ($oName, "mixmax")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

And here is the output!

Any special reason why im getting this error? Aparently the code is all fine.

GrB

Hi,

try this:

#include <IE.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

;Globals
Global $oIE = _IECreateEmbedded()   ;Cria o Internet Explorer Object
Global $URL = "http://ikariam.com.pt/" ;Site
Global $botname = "Ikariam PT Bot"
;$oForm = _IEFormGetObjByName ($oIE, "loginForm"); empty site or other site loaded? -> object without values
;$oName = _IEFormElementGetObjByName ($oForm, "name") ; no values -> error

#Region ### START Koda GUI section ### Form=
GUICreate($botname, 1206, 712, -1, -1)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 50, 1186, 612)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

;$oForm = _IEFormGetObjByName ($oIE, "loginForm") ;dto.
;$oQuery = _IEFormElementGetObjByName ($oForm, "name") ; dto.

_IENavigate ($oIE, $URL)
_IELoadWait ($oIE)
$oForm = _IEFormGetObjByName ($oIE, "loginForm")
$oName = _IEFormElementGetObjByName ($oForm, "name")
_IEFormElementSetValue ($oName, "mixmax")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

You may work with Function IsObj () for error control.

;-))

Stefan

Edited by 99ojo
Link to comment
Share on other sites

well aparently nothing was wrong, it worked with the same code i had! Maybe was something about the web site! But thanks for the fast reply!

Edit, yes when i copy passed the code i forgot to delete the same lines i had to test the best place to put them, sorry for that!

Ok now i have other problem, tryed every way to click on submit and dont work, theres anyway i can do _IEFormElementGetObjById ?? couse the submit button only have this

<input type="submit" class="button" value="Login" />
Edited by GRB
Link to comment
Share on other sites

not working even using this

_IELinkClickByText( $oForm, "Login")

or this

_IEFormSubmit ($oForm)

It just reset the form and stay on the same login page, think its required a click to make it valid, anyway to bypass this?

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...