Jump to content

Auto Sign on to website


John117
 Share

Recommended Posts

The code below is an adaptation from http://www.autoitscript.com/forum/index.ph...st&p=383494

It looks correct to me, but I am missing somthing. I will past the website source below if anyone would like to help see if I got the form name or something else wrong . . .

Please help if you can! :) thanks

CODE
#include <IE.au3>

$oIE = _IECreate("https://www.dyndns.com/account/services/hosts/hatcheda.is-a-geek.com"); Creates IE window

;~ $oIE = _IECreate("https://www.dyndns.com/account/services/hosts/hatcheda.is-a-geek.com", 0, 0)crates hidden IE window

$oForms = _IEFormGetObjByName($oIE, "__login"); Finds the "Form"

$oUsername = _IEFormElementGetObjByName($oForms, "username"); Finds the "username" Field

_IEFormElementSetValue($oUsername, "hatcheda"); Sets the "username" field

$oPassword = _IEFormElementGetObjByName($oForms, "password"); Finds the "password" field

_IEFormElementSetValue($oPassword, "PASSWORDGOESHERE"); Sets the "password" field

_IEFormSubmit($oForms)

Website source is attached

Link to comment
Share on other sites

It doesn't look like the attachment made it. But it's probably not necessary since we can get it from the site in your code example.

Meanwhile, this is an example from Help and you can compare this against what you have.

; *******************************************************
; Example 3 - Login to Hotmail
; *******************************************************
;
#include <IE.au3>
; Create a browser window and navigate to hotmail
$oIE = _IECreate ("http://www.hotmail.com")

; get pointers to the login form and username, password and signin fields
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "SI")

$username = "your username here"
$password = "your password here"

; Set field values and submit the form
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")

Edit: Here is the html code you need to look at for your answer. If you don't see it, use the above example and compare the hotmail.com html code and see how this plays together. As a suggestion, you could post your solution for the benefit of others that might have a similar question in the future :).

<form action="https://www.dyndns.com/account/services/hosts/hatcheda.is-a-geek.com" method="post">
        <input type="hidden" name="__login" value="1" />
        
        <label for="top_username">User:
            <input type="text" name="username" id="top_username" size="14" value="" />
        </label>
        <label for="top_password">Pass:
            <input type="password" name="password" id="top_password" size="14" />
        </label>
        <input type="submit" value="Login" />

    </form>
Edited by ssubirias3
Link to comment
Share on other sites

ok, thanks but I don't see it. :) I also can't access hotmail from work to see the source. :) It's not '__login' which is in the same postion (Name)of the other working code I have.

I went with this . . .

CODE
$URL = "MYWEBADDRESS" ;Define Signon Forwarding Website

$ObjIE = ObjCreate("InternetExplorer.Application") ;Open Forwarding Website

;Wait until Forwarding Website loads

With $ObjIE

.Visible = False

.Navigate ($URL)

Do

Sleep(50)

Until .ReadyState = 4

EndWith

;Set Form Objects on Forwarding Website

With $ObjIE.document.forms (0)

.username.value = "MYUSERID"

.password.value = "MYPASSWORD"

.submit

EndWith

-it works, just not aswell

Edit: yeah, ya might wonna change visible to true. I have it set to false because this was the beginning of an entirely automated code ran by a task.

Edited by Hatcheda
Link to comment
Share on other sites

@Hatcheda - because you've shown you are trying to help yourself, I'll give ya a hint :). When a Form doesn't identify itself with something like <form id="gaia_loginform" then you can't use _IEFormGetObjByName(). In stead you have to use the form's index with _IEFormGetCollection(). That page you are trying to log into has 2 login areas or 2 forms. Here's the code to get you started in the right direction.

_IEFormGetCollection ($oIE, 0)  ;; Top Login
_IEFormGetCollection ($oIE, 2)  ;; Other Login

btw, good job in coming up with a different method!

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