Sign in to follow this  
Followers 0
jimmyjmmy

How do I fill hotmail form

18 posts in this topic

Hi I have the following script to fill in hotmail form but it wont work, whats wrong?

Thanks

#include <IE.au3>

$oIE = _IECreate ("http://get.live.com/mail/overview")

WinSetState ( "Windows Live Hotmail - Windows Internet Explorer", "Windows Live Hotmail - Windows Internet Explorer", @SW_MAXIMIZE )

WinWaitActive("Windows Live Hotmail - Windows Internet Explorer")

AutoItSetOption ( "MouseCoordMode",0 )

MouseClick ("left",184,386)

WinWaitActive("Sign up for Windows Live - Windows Internet Explorer")

$oForm = _IEFormGetCollection ($oIE, 0)

$Emailaddress = _IEFormElementGetObjByName ($oForm, "E-mail address")

$myemailaddress = "anything@yahoo.com"

_IEFormElementSetValue ($Emailaddress,$myemailaddress)

Share this post


Link to post
Share on other sites



Hi I have the following script to fill in hotmail form but it wont work, whats wrong?

Thanks

#include <IE.au3>

$oIE = _IECreate ("http://get.live.com/mail/overview")

WinSetState ( "Windows Live Hotmail - Windows Internet Explorer", "Windows Live Hotmail - Windows Internet Explorer", @SW_MAXIMIZE )

WinWaitActive("Windows Live Hotmail - Windows Internet Explorer")

AutoItSetOption ( "MouseCoordMode",0 )

MouseClick ("left",184,386)

WinWaitActive("Sign up for Windows Live - Windows Internet Explorer")

$oForm = _IEFormGetCollection ($oIE, 0)

$Emailaddress = _IEFormElementGetObjByName ($oForm, "E-mail address")

$myemailaddress = "anything@yahoo.com"

_IEFormElementSetValue ($Emailaddress,$myemailaddress)

Not really enough information for me to say what's wrong.

If the coords for the mouse click were obtained from Autit WIndo info Control tab then the coords are relative to the client area and you need to set

AutoItSetOption ( "MouseCoordMode",2 )

Otherwise you need to say what does happen. "Won't work" doesn't tell us what you've done to try and find out what's wrong. Put some extra lines in to check for errors and use consolewrite to tell you what's happening.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Not really enough information for me to say what's wrong.

............Otherwise you need to say what does happen. "Won't work" doesn't tell us what you've done to try and find out what's wrong. Put some extra lines in to check for errors and use consolewrite to tell you what's happening.

Thanks for the reply.

I am learning how to fill in forms using autoIT.

So I have this script that is suppose to fill in the email address of Hotmail-sign-up-page but unfortunately, the script does not fill in anything at the 'email address' box.

The problem I face is that I know every form has a name but I could not locate the formname after seeking from internetexplorer--view--source. In addition, I am still not very sure how to use the autoIT commands on forms. So any help is very much appreciated.

Thanks.

----------------script----------------------

#include <IE.au3>

$oIE = _IECreate ("http://get.live.com/mail/overview")

WinSetState ( "Windows Live Hotmail - Windows Internet Explorer", "Windows Live Hotmail - Windows Internet Explorer", @SW_MAXIMIZE )

WinWaitActive("Windows Live Hotmail - Windows Internet Explorer")

AutoItSetOption ( "MouseCoordMode",0 )

MouseClick ("left",184,386)

WinWaitActive("Sign up for Windows Live - Windows Internet Explorer")

$oForm = _IEFormGetCollection ($oIE, 0)

$Emailaddress = _IEFormElementGetObjByName ($oForm, "E-mail address")

$myemailaddress = "anything@yahoo.com"

_IEFormElementSetValue ($Emailaddress,$myemailaddress)

Share this post


Link to post
Share on other sites

Perhaps you can explain in detail what you are trying and what isn't working?

Wht are you trying to do with there commands:

WinSetState ( "Windows Live Hotmail - Windows Internet Explorer", "Windows Live Hotmail - Windows Internet Explorer", @SW_MAXIMIZE )

WinWaitActive("Windows Live Hotmail - Windows Internet Explorer")

AutoItSetOption ( "MouseCoordMode",0 )

MouseClick ("left",184,386)

WinWaitActive("Sign up for Windows Live - Windows Internet Explorer")

Also, please run this code using Tools -> Go in SciTe because IE.au3 goes to great lengths to give you helpful diagnostic messages there.

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

Share this post


Link to post
Share on other sites

Perhaps you can explain in detail what you are trying and what isn't working?....

Thanks for the feedback.

What I am trying to do is to go to hotmail sign up page and fill in only the email address (with this knowledge I can fill in the rest), and so I have the following script. When I run the script, I expect the script to fill in "anything@yahoo.com" at the email address box but it is not showing and there are also no errors. So what must I do so that I can put "anything@yahoo.com" in the email address box.

Thanks

------------script------------------------

#include <IE.au3>

;cause IE to goto hotmail sign up page

$oIE = _IECreate ("https://signup.live.com/hmnewuser.aspx?ru=http://mail.live.com/?newuser=yes&hm=1&rx=http://get.live.com/mail/overview&mkt=en-sg&revipc=sg&ts=3862093&sh=s2hk&rollrs=04&lic=1")

;wait for the window to be active

WinWaitActive("Sign up for Windows Live - Windows Internet Explorer")

;get the form name or handle and put it into the variable $oForm

$oForm = _IEFormGetCollection ($oIE, 0)

;extract the element of E-mail address and store it into a variable $Emailaddress

$Emailaddress = _IEFormElementGetObjByName ($oForm, "E-mail address")

;set the variable $myemailaddress

$myemailaddress = "anything@yahoo.com"

;set the value of the form element

_IEFormElementSetValue ($Emailaddress,$myemailaddress)

Share this post


Link to post
Share on other sites

OK, now that you've given me the real URL I can see what is happening.

This page is doing some creative (non-standard) things by using form input fields that are not defined as part of a <FORM>. You therefore need to obtain your form element reference by using _IEGetObjByName (it can also be done with _IETagNameGetCollection, but it is a bit harder).

This should get you going (BTW, I found the ID of the email address field using the IE Developer Toolbar - see my sig):

#include <IE.au3>

$oIE = _IECreate ("https://signup.live.com/hmnewuser.aspx?ru=http://mail.live.com/?newuser=yes&hm=1&rx=http://get.live.com/mail/overview&mkt=en-sg&revipc=sg&ts=3862093&sh=s2hk&rollrs=04&lic=1")

$Emailaddress = _IEGetObjByName ($oIE, "iAltEmail")
_IEFormElementSetValue ($Emailaddress,"your value")

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

Share this post


Link to post
Share on other sites

Thank You very much DaleHohm and also for the developer tool.

Yes, precisely thats what I wanted to do.

To eliminate human error, instead of visually finding, are there any autoiT commands to look for the element name such as this, "iAltEmail".

Thanks

OK, now that you've given me the real URL I can see what is happening.

This page is doing some creative (non-standard) things by using form input fields that are not defined as part of a <FORM>. You therefore need to obtain your form element reference by using _IEGetObjByName (it can also be done with _IETagNameGetCollection, but it is a bit harder).

This should get you going (BTW, I found the ID of the email address field using the IE Developer Toolbar - see my sig):

#include <IE.au3>

$oIE = _IECreate ("https://signup.live.com/hmnewuser.aspx?ru=http://mail.live.com/?newuser=yes&hm=1&rx=http://get.live.com/mail/overview&mkt=en-sg&revipc=sg&ts=3862093&sh=s2hk&rollrs=04&lic=1")

$Emailaddress = _IEGetObjByName ($oIE, "iAltEmail")
_IEFormElementSetValue ($Emailaddress,"your value")

Dale

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

are there any autoiT commands to look for the element name such as this, "iAltEmail"

No. MODIV2, IE Developer Toolbar (see my sig) and the FireFox DOM inspector are what I use.

Dale

Edit: Typo

Edited by DaleHohm

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

No. MODIV2, IE Developer Toolbar (see my sig) and the FireFox DOM inspector are what I use.

Dale

Edit: Typo

Once again, Thank You very much DaleHohm. I've downloaded n installed IE Developer Toolbar and its a great help.

Many thanks.

Share this post


Link to post
Share on other sites

#10 ·  Posted

................

Sorry to trouble members again. In hotmail sign up page, there are 2 radio buttons, M and F, and I wanted to select "m" and so I use the _IEFormElementRadioSelect command, but I was not able to select the "m" button. this is what I did :-

$Gender = _IEGetObjByName ($oIE, "iGenderMale")

_IEFormElementRadioSelect ($Gender, "m", "profile_gender", 1, "byValue")

The HTML code below.

----------html code -------------

<INPUT class="genderMale profileGender" id="iGenderMale" type="radio" name="profile_gender" errorClass="GenderError" errorArea="p.GenderErrorArea" warningClass="GenderError" value="m" />

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

_IEFormElementRadioSelect uses a Form object as the first parameter, not the radio button.

Dale

P.S. Are you running your scripts in SciTe (Tools -> Go) ????!!!!??? IE.au3 goes to great trouble to help you with situations like this and would have told you that you had passed an invalid object type. Please pay attention to this and post the console output when asking for help.

Edited by DaleHohm

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

#12 ·  Posted

_IEFormElementRadioSelect uses a Form object as the first parameter, not the radio button.

Dale

P.S. Are you running your scripts in SciTe (Tools -> Go) ????!!!!??? IE.au3 goes to great trouble to help you with situations like this and would have told you that you had passed an invalid object type. Please pay attention to this and post the console output when asking for help.

Thanks Dale,

All the while I did not know that I could run the script from Scite. Of course now I know. Thanks

I tried to locate the form name of Hotmail sign up page, but I could not. I use the 'IE Dom Explorer' to find but I could not locate the form name also. I look at help file on IEFormElementRadioSelect and I notice that the example first got to know the name of the form, in help example, the form name was "ExampleForm".

So what must I do to select the "m" "f" button when I dont know the form name.

hotmail sign up url -----> https://signup.live.com/hmnewuser.aspx?ru=h...rs=04&lic=1

Thanks a lot.

-------- script from autoIT helpfile ----------

#include <IE.au3>

$oIE = _IE_Example ("form")

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

_IEFormElementRadioSelect ($oForm, "vehicleAirplane", "radioExample", 1, "byValue")

Share this post


Link to post
Share on other sites

#13 ·  Posted

When the form has no name, use _IEFormGetCollection

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

Share this post


Link to post
Share on other sites

#14 ·  Posted

When the form has no name, use _IEFormGetCollection

Dale

Thanks,

What must I do to select this radio button. I dont have any luck to get it right.

<INPUT class="genderMale profileGender" id="iGenderMale" type="radio" name="profile_gender" errorClass="GenderError" errorArea="p.GenderErrorArea" warningClass="GenderError" value="m" />

I do this but when I run the script from Scite, it says "--> IE.au3 Warning from function _IEFormElementRadioSelect, $_IEStatus_NoMatch"

------------------------ script--------------------

$oIE = _IECreate ("https://signup.live.com/hmnewuser.aspx?ru=http://mail.live.com/?newuser=yes&hm=1&rx=http://get.live.com/mail/overview&mkt=en-sg&revipc=sg&ts=3862093&sh=s2hk&rollrs=04&lic=1")

$oForms = _IEFormGetCollection ($oIE,0)

_IEFormElementRadioSelect ($oForms, "m", "profile_gender", 1, "byIndex")

Share this post


Link to post
Share on other sites

#15 ·  Posted

I see that it is becomming common practice to use form elements like radio buttons and checkboxes without making them part of <FORM>s as is being done in this case.

This will get you going in this case:

$oMale = _IEGetObjByName($oIE, "iGenderMale")
_IEAction($oMale, "click")

I'm going to need to rethink the assumptions on some of the _IEForm* functions.

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

Share this post


Link to post
Share on other sites

I see that it is becomming common practice to use form elements like radio buttons and checkboxes without making them part of <FORM>s as is being done in this case.

This will get you going in this case:

$oMale = _IEGetObjByName($oIE, "iGenderMale")
_IEAction($oMale, "click")

I'm going to need to rethink the assumptions on some of the _IEForm* functions.

Dale

Thank You very Much DaleHohm. Yes it works this time.

I have a question :-

(1) So if a form do not have a name, then I use _IEGetObjByName.

(2) Suppose a form have a name, can i also use this same method.

Thanks

Share this post


Link to post
Share on other sites

Thank You very Much DaleHohm. Yes it works this time.

I have a question :-

(1) So if a form do not have a name, then I use _IEGetObjByName.

(2) Suppose a form have a name, can i also use this same method.

Thanks

_IEForGetCollection can always be used, _IEFormGetObjByName can only be used when there IS a name

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

Share this post


Link to post
Share on other sites

_IEForGetCollection can always be used, _IEFormGetObjByName can only be used when there IS a name

Dale

Thank You very very Much!

Thanks a lot.

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