jimmyjmmy Posted May 5, 2007 Share Posted May 5, 2007 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) Link to comment Share on other sites More sharing options...
martin Posted May 5, 2007 Share Posted May 5, 2007 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 setAutoItSetOption ( "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. Link to comment Share on other sites More sharing options...
jimmyjmmy Posted May 5, 2007 Author Share Posted May 5, 2007 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) Link to comment Share on other sites More sharing options...
DaleHohm Posted May 6, 2007 Share Posted May 6, 2007 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 Link to comment Share on other sites More sharing options...
jimmyjmmy Posted May 6, 2007 Author Share Posted May 6, 2007 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 activeWinWaitActive("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) Link to comment Share on other sites More sharing options...
DaleHohm Posted May 6, 2007 Share Posted May 6, 2007 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 Link to comment Share on other sites More sharing options...
jimmyjmmy Posted May 6, 2007 Author Share Posted May 6, 2007 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 Link to comment Share on other sites More sharing options...
DaleHohm Posted May 6, 2007 Share Posted May 6, 2007 (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.DaleEdit: Typo Edited May 6, 2007 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 Link to comment Share on other sites More sharing options...
jimmyjmmy Posted May 7, 2007 Author Share Posted May 7, 2007 No. MODIV2, IE Developer Toolbar (see my sig) and the FireFox DOM inspector are what I use.DaleEdit: TypoOnce again, Thank You very much DaleHohm. I've downloaded n installed IE Developer Toolbar and its a great help.Many thanks. Link to comment Share on other sites More sharing options...
jimmyjmmy Posted May 7, 2007 Author Share Posted May 7, 2007 ................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" /> Link to comment Share on other sites More sharing options...
DaleHohm Posted May 7, 2007 Share Posted May 7, 2007 (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 May 7, 2007 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 Link to comment Share on other sites More sharing options...
jimmyjmmy Posted May 9, 2007 Author Share Posted May 9, 2007 _IEFormElementRadioSelect uses a Form object as the first parameter, not the radio button.DaleP.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. ThanksI 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=1Thanks a lot.-------- script from autoIT helpfile ----------#include <IE.au3>$oIE = _IE_Example ("form")$oForm = _IEFormGetObjByName ($oIE, "ExampleForm") _IEFormElementRadioSelect ($oForm, "vehicleAirplane", "radioExample", 1, "byValue") Link to comment Share on other sites More sharing options...
DaleHohm Posted May 9, 2007 Share Posted May 9, 2007 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 Link to comment Share on other sites More sharing options...
jimmyjmmy Posted May 9, 2007 Author Share Posted May 9, 2007 When the form has no name, use _IEFormGetCollectionDaleThanks,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") Link to comment Share on other sites More sharing options...
DaleHohm Posted May 9, 2007 Share Posted May 9, 2007 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 Link to comment Share on other sites More sharing options...
jimmyjmmy Posted May 12, 2007 Author Share Posted May 12, 2007 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. DaleThank 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 Link to comment Share on other sites More sharing options...
DaleHohm Posted May 12, 2007 Share Posted May 12, 2007 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 nameDale 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 Link to comment Share on other sites More sharing options...
jimmyjmmy Posted May 12, 2007 Author Share Posted May 12, 2007 _IEForGetCollection can always be used, _IEFormGetObjByName can only be used when there IS a nameDaleThank You very very Much!Thanks a lot. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now