Sign in to follow this  
Followers 0
CrewXp

Any way to auto 'login' from autoit to a site like microsoft.com, or hotmail.com?

8 posts in this topic

Hey, I was wondering. I'm trying to embed a website in autoit. It uses the same login as microsoft.com, and hotmail.com (the passport login).

But instead of logging in every time, is there any way autoit can send the username and password to it, and post it? Thus, automatically logging in?

-Thanks

Share this post


Link to post
Share on other sites



This code logs in to xbox.com which uses passport,

[autoit=]#include <IE.au3>

$oIE = _IECreate("http://login.live.com/login.srf?wa=wsignin1.0&rpsnv=10&ct=1192875096&rver=4.0.1534.0&wp=MBI&wreply=https:%2F%2Flive.xbox.com%2Fxweb%2Flive%2Fpassport%2FsetCookies.ashx%3Frru%3DhttpZ3AZ2FZ2FwwwZ2ExboxZ2EcomZ2FenZ2DGBZ2F&lc=2057&cb=B002057httpZ3AZ2FZ2FwwwZ2ExboxZ2EcomZ2FenZ2DGBZ2F&id=66262")

$oForm = _IEFormGetObjByName($oIE, "f1")

$oUser = _IEFormElementGetObjByName($oForm, "login")

$oPass = _IEFormElementGetObjByName($oForm, "passwd")

_IEFormElementSetValue($oUser, "myemail@test.com")

_IEFormElementSetValue($oPass, "password")

_IEFormSubmit($oForm)[\autoit]

To get it to work on the site you have change the url and if the names of the form is different change that.

Share this post


Link to post
Share on other sites

I'm interested in this topic and I was wondering where can I see the names of the forms?

Share this post


Link to post
Share on other sites

...I was wondering where can I see the names of the forms?

You have to open the page source (View->HTML) and look for the html tag named <FORM> and check its NAME and ID respectively.

Share this post


Link to post
Share on other sites

I suggest DebugBar (see my sig)


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

This code logs in to xbox.com which uses passport,

[autoit=]#include <IE.au3>

$oIE = _IECreate("http://login.live.com/login.srf?wa=wsignin1.0&rpsnv=10&ct=1192875096&rver=4.0.1534.0&wp=MBI&wreply=https:%2F%2Flive.xbox.com%2Fxweb%2Flive%2Fpassport%2FsetCookies.ashx%3Frru%3DhttpZ3AZ2FZ2FwwwZ2ExboxZ2EcomZ2FenZ2DGBZ2F&lc=2057&cb=B002057httpZ3AZ2FZ2FwwwZ2ExboxZ2EcomZ2FenZ2DGBZ2F&id=66262")

$oForm = _IEFormGetObjByName($oIE, "f1")

$oUser = _IEFormElementGetObjByName($oForm, "login")

$oPass = _IEFormElementGetObjByName($oForm, "passwd")

_IEFormElementSetValue($oUser, "myemail@test.com")

_IEFormElementSetValue($oPass, "password")

_IEFormSubmit($oForm)[\autoit]

To get it to work on the site you have change the url and if the names of the form is different change that.

Hi! I am trying to write a script to login to this forum,

http://www.forex-tsd.com/

I searched for <FORM > but it looks like this page does not have one.

Pls advise how to modify your code to login to this ?

Thanks in advance.

pjo

Share this post


Link to post
Share on other sites

Hi! I am trying to write a script to login to this forum,

http://www.forex-tsd.com/

I searched for <FORM > but it looks like this page does not have one.

Pls advise how to modify your code to login to this ?

Thanks in advance.

pjo

Try selecting the login box the right-click-> Source code of selection (just guessing,i'm using firefox PT-BR)

Share this post


Link to post
Share on other sites

Try selecting the login box the right-click-> Source code of selection (just guessing,i'm using firefox PT-BR)

danielkza tahnks for your reply.

It if Firefox here too.

Marking the login area and right click and displa the source shows the followings:

<label for="navbar_username">User Name</label></td>

<td><input class="bginput" style="font-size: 11px;" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="User Name" onfocus="if (this.value == 'User Name') this.value = '';" type="text"></td>

<td class="smallfont" colspan="2" nowrap="nowrap"><label for="cb_cookieuser_navbar"><input name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c" type="checkbox">Remember Me?</label></td>

</tr>

<tr>

<td class="smallfont"><label for="navbar_password">Password</label></td>

<td><input class="bginput" style="font-size: 11px;" name="vb_login_password" id="navbar_password" size="10" tabindex="102" type="password"></td>

<td><input class="button" value="Log in" tabindex="104" title="Enter your username and password in the boxes provided to login, or click the 'register' button to create a profile for yourself." accesskey="s" type="submit"></td>

</tr>

</tbody>

There is another login area:

<td style="white-space: nowrap;" class="smallfont">User Name</td>

<td><input class="bginput" name="vb_login_username" size="12" tabindex="577" type="text"></td>

<td style="white-space: nowrap;" class="smallfont"><input checked="checked" class="bginput" name="cookieuser" id="cb_cookieuser" value="1" type="checkbox"><label for="cb_cookieuser">Remember Me?</label></td>

<td rowspan="2" align="center" width="100%">Not a member yet?<br>

<a href="http://www.forex-tsd.com/register.php">Register Now!</a></td>

</tr>

<tr>

<td class="smallfont">Password</td>

<td><input class="bginput" name="vb_login_password" size="12" tabindex="578" type="password"></td>

<td><input class="button" value="Log in" tabindex="579" type="submit"></td>

</tr>

</tbody>

How the code should be modified ?

pjo

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