Jump to content

Troubles With Auto-login Script


Recommended Posts

Hey guys! I am new member, so i will introduce myself - Pawel from Poland. I am learning AutoIt. Now i want to make some auto-login script using IE.au3. Already managed to make login automated by moving mouse, SENDing text and mouse-clicking on LOGIN button on some pages. Now time for harder stuff.

When website has proper form, with name for it - i can do it. But some WWW sites dont have names for forms! For example:

<form method="post" action="/login.dt">
        <tr> 
          <td width="160"><img src="/templates/notloggedin/images/topsection/leftknight.jpg" width="160" height="93"></td>

          <td align="center"><img src="/templates/notloggedin/images/topsection/mainheader.jpg" width="431" height="93"></td>
          <td valign="top" align="right" width="160">
            <img src="/templates/notloggedin/images/login/emailhead.gif" width="160" height="12"><br>
            <input type="text" name="email" style="border: 0px; background-color: #576D54; font-size: 8pt; color: #FFCC66; width: 160px; height: 14px"><br>
            <img src="/templates/notloggedin/images/login/passwordhead.gif" width="160" height="12"><br>
            <input type="password" name="password" style="border: 0px; background-color: #576D54; font-size: 8pt; color: #FFCC66; width: 160px; height: 14px"><br>
            <a href="forgotpassword.dt"><img src="/templates/notloggedin/images/login/forgotpass.gif" width="160" height="20" border="0"></a><br>
            <input type="hidden" name="submit" value="TRUE">
            <input type="image" src="/templates/notloggedin/images/login/login.gif" style="border: 0px"><a href="register.dt"><img src="/templates/notloggedin/images/login/joinnow.gif" width="81" height="15" border="0"></a>

          </td>
        </tr>
        </form>

How i can auto-login on those kind of pages? I cant _IEFormGetObjByName. I tried _IEFormGetCount($oIE). It returns 1 - so it is ok - there is one form. But how i can use _IEFormElementGetObjByName, when it needs _IEFormGetObjByName called first? Also i'd tried _IEFormGetObjByIndex($oIE,number_here?) but it dosent works neither. It always gives me error "Variable must be of type "Object"" - so just i cant get handle for whole form.

I also have trouble when i need to submit form. On some pages i managed to fill in properly form fields, but submit is done via image (you click on image), and submitting form from IE.au3 seems to not work properly for those pages.

Edited by misioooo
Link to comment
Share on other sites

Thank You Valuater. It is indeed great tut prog! But there is not even single word how to handle forms without name. Everywhere name of form is needed :/ And like in my first post - on some WWW pages there are forms without names. I dont know how to handle them.

Using Your tutorial progie i managed to get those damn submit buttons to work properly :)

Edited by misioooo
Link to comment
Share on other sites

So anyone willing to help me make auto login script for darkthrone.com? :)

Valuater in Your AutoIt123 there is example with submit button in DT game :mellow: Now just tell me how i can fill in form fields there - coz form has no "name" parameter.

Link to comment
Share on other sites

Use _IEFormGetObjByIndex() ... Check the IE.au3 documentation on how to use, but it works nicely like so:

$email="your email here"
$password="your password here"
$oForm=_IEFormGetObjByIndex($IE_window,0)
$oEmail=_IEFormElementGetObjByName($oForm,"email")
$oPassword=_IEFormElementGetObjByName($oForm,"password")
_IEFormSetValue($oEmail,$email)
_IEFormSetValue($oPassword,$password)

---Sparkes.

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