Kidney Posted December 8, 2011 Share Posted December 8, 2011 Hey guys!i havent posted much on here but i have read through many threads and picked up on many useful tips and tricks on many scripts i have wrote so id just like to say thanks for the awesome support and good explanations to help understand autoIT.With that being said, i have a question that you guys might be able to shed some light on if you have ever come across something like this.My friend has a data entry job for his moms real-estate business and it includes filling out these forms online. not too long ago, the website he was getting his information from just switched from having scanned in jpeg's of hand written forms to electronic forms. i have successfully collected all of the info from the forms he gets online already. now the part im not sure about is transferring that info to the other website.here is a screenshot of the website he will be filling out just as reference:here is the script i have already that fills out the Dates, times and the SubAgentID:expandcollapse popupFunc Fill() $ContactTime = StringReplace($ContactTime, "M", " ") $ContactTime = StringReplace($ContactTime, ":", " ") $ContactTime = StringReplace($ContactTime, " ", "") $StringL = StringTrimRight($ContactTime, 3) $StringR = StringRight($ContactTime, 3) $StringL2 = StringLeft($StringR, 2) $AMPM = StringRight($ContactTime, 1) If $StringL = 10 Then $StringL3 = "1" Else $StringL3 = "0" & $StringL If $StringL = 11 Then $StringL3 = "11" Else $StringL3 = "0" & $StringL If $StringL = 12 Then $StringL3 = "12" Else $StringL3 = "0" & $StringL EndIf EndIf EndIf $FinalString = $StringL3 & "{TAB}" & $StringL2 & "{TAB}" & $AMPM MouseClick("Left", 588, 502, 1, 0) Sleep(100) Send($ContactDate) SLeep(200) Send("{TAB}") Sleep(200) Send($FinalString) $SecondTime = StringReplace($SecondTime, "M", " ") $SecondTime = StringReplace($SecondTime, ":", " ") $SecondTime = StringReplace($SecondTime, " ", "") $StringL = StringTrimRight($SecondTime, 3) $StringR = StringRight($SecondTime, 3) $StringL2 = StringLeft($StringR, 2) $AMPM = StringRight($SecondTime, 1) If $StringL = 10 Then $StringL3 = "1" Else $StringL3 = "0" & $StringL If $StringL = 11 Then $StringL3 = "11" Else $StringL3 = "0" & $StringL If $StringL = 12 Then $StringL3 = "12" ElseIf $SecondTime = "" Then $StringL3 = $StringL Else $StringL3 = "0" & $StringL EndIf EndIf EndIf $FinalString = $StringL3 & "{TAB}" & $StringL2 & "{TAB}" & $AMPM Sleep(100) Send("{TAB}") Sleep(200) Send($SecondDate) SLeep(200) Send("{TAB}") Sleep(200) Send($FinalString) SLeep(200) Send("{TAB}") Sleep(200) Send($AgentID) EndFuncnow for the question and your guys ideas. i know how to code the rest of it to fill out the rest of the info, but how should i have it scroll down the page so it can fill out the form? i have tried the MouseWheel function but sometimes its a little inaccurate. are there anyways to make it stop and a specific point? any way to increase accuracy of entry?one idea i had was to work backwards. as in, fill it out from the bottom and go upwards since the form is always the same. is there a better way that u guys can think of or something i should experiment with??Anything is helpful! Link to comment Share on other sites More sharing options...
kylomas Posted December 8, 2011 Share Posted December 8, 2011 (edited) kidney,i have successfully collected all of the info from the forms he gets online alreadyIn what form, flat file on PC, collection of paper, etcA better technique for populating a WEB page is to use Dale Holm's excellent IE.udf. See the help file for functions prefixed with "_IE".kylomasEdit: add reference linksee this link for example of populating a WEB form Edited December 8, 2011 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Kidney Posted December 8, 2011 Author Share Posted December 8, 2011 they r online files that u view through your web browser. Link to comment Share on other sites More sharing options...
kylomas Posted December 8, 2011 Share Posted December 8, 2011 kidney, Good, you can read the data from one WEB site and populate the form in the target WEB site. See the link that I posted for an example of forms processing. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Kidney Posted December 8, 2011 Author Share Posted December 8, 2011 well i cant populate it yet. i have the very first portion just cuz its the first thing u see. my question is how should i go about filling out the rest of the form?? Link to comment Share on other sites More sharing options...
JohnOne Posted December 8, 2011 Share Posted December 8, 2011 kylomas is telling you, you do not need to scroll anything, with IE UDF you can fill in the forms/fields without scrolling or clicking anything at all. Take a look at the examples. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Kidney Posted December 8, 2011 Author Share Posted December 8, 2011 (edited) ok so in the _IE_Example, it opens up 'form' and i see that it has radio buttons and check boxes. it also has the the source code u need to select them?? is that correct? if so, here is the source for the website in the s/s of the radio buttons: <td><input id="ctl00_MainContent_rbAddrGivenFor_0" type="radio" name="ctl00$MainContent$rbAddrGivenFor" value="1" /><label for="ctl00_MainContent_rbAddrGivenFor_0">Home</label></td><td><input id="ctl00_MainContent_rbAddrGivenFor_1" type="radio" name="ctl00$MainContent$rbAddrGivenFor" value="3" onclick="javascript:alert('You MUST enter the name of the ACTUAL BUSINESS operating at the Address.');" /><label for="ctl00_MainContent_rbAddrGivenFor_1">Business (Specify Below)</label></td><td><input id="ctl00_MainContent_rbAddrGivenFor_2" type="radio" name="ctl00$MainContent$rbAddrGivenFor" value="5" /><label for="ctl00_MainContent_rbAddrGivenFor_2">Condominium</label></td> </tr><tr> <td><input id="ctl00_MainContent_rbAddrGivenFor_3" type="radio" name="ctl00$MainContent$rbAddrGivenFor" value="2" /><label for="ctl00_MainContent_rbAddrGivenFor_3">Apartment</label></td><td><input id="ctl00_MainContent_rbAddrGivenFor_4" type="radio" name="ctl00$MainContent$rbAddrGivenFor" value="4" /><label for="ctl00_MainContent_rbAddrGivenFor_4">Mobile/Modular Home</label></td><td><input id="ctl00_MainContent_rbAddrGivenFor_5" type="radio" name="ctl00$MainContent$rbAddrGivenFor" value="-1" /><label for="ctl00_MainContent_rbAddrGivenFor_5">Other (Describe Below)</label></td> sry its really wide. but i have little to no experience with IE.au3 for an example, can u show me what command u would use to select the Airplane radio button in the _IE_Example?? i know its asking a lot but once i can see it done then i can usually figure the more complex things. Edited December 8, 2011 by Kidney Link to comment Share on other sites More sharing options...
kylomas Posted December 8, 2011 Share Posted December 8, 2011 kidney, look at the link from post #2... kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Kidney Posted December 8, 2011 Author Share Posted December 8, 2011 kylomas, if i use the code that was quoted in post #24, all it does it open hotmail.com. it doesnt fill it out for me. or is it supposed to?? Link to comment Share on other sites More sharing options...
kylomas Posted December 8, 2011 Share Posted December 8, 2011 kidney, Seriously???? The link that I posted is an EXAMPLE of how to update a form in a WEB site. Let me see the code that is calling "fill()" (from your initial post... kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Kidney Posted December 8, 2011 Author Share Posted December 8, 2011 (edited) kylomas, ok after looking at it now i understand what u r saying and some what how to use the IE.au3 /e ok now i have a questions. using the code i provided above (post #7), how would i seletc the "Home" radio button?? just to view it easier: <input id="ctl00_MainContent_rbAddrGivenFor_0" type="radio" name="ctl00$MainContent$rbAddrGivenFor" value="1" /> <label for="ctl00_MainContent_rbAddrGivenFor_0">Home</label> which do i use for the $s_string and the $s_name?? i tried: $s_string = ctl00_MainContent_rbAddrGivenFor_0 $s_name = ctl00$MainContent$rbAddrGivenFor but no luck. here is the code as of right now but without the username and password. i also couldnt get the submit button to work #include <IE.au3> $oIE = _IECreate ("https://agents.jmadjustment.com/SignOn.aspx?MSG=MSG_SESSION_EXPIRED",1) $o_form = _IEFormGetObjByName ($oIE, "ctl01") $o_login = _IEFormElementGetObjByName ($o_form, "AgentID") $o_password = _IEFormElementGetObjByName ($o_form, "Password") $o_signin = _IEFormElementGetObjByName ($o_form, "btnSubmit") $username = "username" $password = "pass" _IEFormElementSetValue ($o_login, $username) _IEFormElementSetValue ($o_password, $password) Send("{ENTER}") _IENavigate($oIE, "https://agents.jmadjustment.com/UpdateFieldCallResult.aspx?CustomerID=1974966&CustAddressID=0") $o_form = _IEFormGetObjByName ($oIE, "aspnetForm") $o_Contact = _IEFormElementGetObjByName ($o_form, "ctl00$MainContent$txtContactDate") $Contact = "Test" _IEFormElementSetValue ($o_Contact, $Contact) _IEFormElementRadioSelect ($o_form, "Apartment", "ctl00_MainContent_rbAddrGivenFor_3") Edited December 8, 2011 by Kidney Link to comment Share on other sites More sharing options...
kylomas Posted December 8, 2011 Share Posted December 8, 2011 kidney, Don't use "SEND" to click, see IEAction in the help file, however, I am no expert, in fact have not used these till your post. There are numerous examples if you search the forum. If you need more in depth help one of the experts will assist you. When asking for help you will alway need the following: 1 - description of problem in terms of actual VS expected results, in detail 2 - example of code producing the problem Good Luck, kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
JohnOne Posted December 8, 2011 Share Posted December 8, 2011 Instead of "Send("{ENTER}")" Try _IEFormSubmit ($o_form) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Kidney Posted December 8, 2011 Author Share Posted December 8, 2011 Instead of "Send("{ENTER}")"Try_IEFormSubmit ($o_form)the sign in button has an onclick javascript that it runs. when i do the _IEFormSubmit, it just clears the username and password. Link to comment Share on other sites More sharing options...
JohnOne Posted December 8, 2011 Share Posted December 8, 2011 There are other ways of clicking buttons/links search "onclick javascript" you will find some pretty easily' AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Kidney Posted December 9, 2011 Author Share Posted December 9, 2011 There are other ways of clicking buttons/linkssearch "onclick javascript" you will find some pretty easily'couldnt find anything that worked for me.... but, {ENTER} works just fine for the situation at hand. Link to comment Share on other sites More sharing options...
JohnOne Posted December 9, 2011 Share Posted December 9, 2011 Well if that is all what works for you then so be it, but I still don't think you need to scroll Use _IEAction($object,"focus") before sending your key. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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