chappoian Posted April 13, 2010 Posted April 13, 2010 (edited) EDIT (16-apr-2010:) Current state: Great! it works now. Now I added a step two, to make it even harder ! The current code is: expandcollapse popup#include <IE.au3> $sUsername = "oDon" $sPassword = "uh0uxt9t" $sUrl = "http://www.bootleggers.us/" $oIE = _IECreate ($sUrl) $oForm = _IEFormGetCollection ($oIE, 2) $oUsername = _IEFormElementGetObjByName ($oForm, "Username") $oPassword = _IEFormElementGetObjByName ($oForm, "Password") _IEFormElementSetValue ($oUsername, $sUsername) _IEFormElementSetValue ($oPassword, $sPassword) _IEFormSubmit ($oForm) While 1 _IELinkClickByText ($oIE, "crimes") Sleep(100) $oForm = _IEFormGetCollection ($oIE, 0) _IEFormElementRadioSelect ($oForm, "4", "select_crime", 1, "byValue") $oSubmit = _IEGetObjByName ($oIE, "aCrime") _IEAction ($oSubmit, "click") Sleep(1000) _IELinkClickByText ($oIE, "Auto Burglary") Sleep(100) $oForm = _IEFormGetCollection ($oIE, 0) _IEFormElementRadioSelect ($oForm, "1", "select_crime", 1, "byValue") $oSubmit = _IEFormGetObjByName ($oIE, "Steal") _IEAction ($oSubmit, "click") Sleep(120000) _IELinkClickByText ($oIE, "crimes") Sleep(100) $oForm = _IEFormGetCollection ($oIE, 0) _IEFormElementRadioSelect ($oForm, "4", "select_crime", 1, "byValue") $oSubmit = _IEGetObjByName ($oIE, "aCrime") _IEAction ($oSubmit, "click") Sleep(125000) WEnd What I did, was add a second task, which is: Auto Burglary. So now it commits a crime, steal a car, wait 2 mins, commit another crime, wait two minutes, and do it all again. Only one problem, it does not steal a car. It selects the right box, but does not complete the form. I tried to get the right name for the form completion, but it was not present at the source code: <tr> <td align=right colspan=2><input type=submit value="Steal"></td> </tr> Full form code: expandcollapse popup<form method=POST action=/autoburglary.php> <table width=80% cellspacing=0 cellpadding=2 border=1 bordercolor=black class=sub2> <tr> <td colspan=2 class=header align=center>Crimes</td> </tr> <tr> <td><input type=radio name=select_crime value="1" id="selectedCrime[1]"> <label for="selectedCrime[1]" style="cursor: pointer;">Car jack from street</label> </td> <td>1% chance</td> </tr> <tr> <td><input type=radio name=select_crime value="2" id="selectedCrime[2]"> <label for="selectedCrime[2]" style="cursor: pointer;">Steal from a private parking lot</label> </td> <td>0% chance</td> </tr> <tr> <td><input type=radio name=select_crime value="3" id="selectedCrime[3]"> <label for="selectedCrime[3]" style="cursor: pointer;">Pick pocket keys</label> </td> <td>1% chance</td> </tr> <tr> <td><input type=radio name=select_crime value="4" id="selectedCrime[4]"> <label for="selectedCrime[4]" style="cursor: pointer;">Steal from a public parking lot</label> </td> <td>0% chance</td> </tr> <tr> <td><input type=radio name=select_crime value="5" id="selectedCrime[5]"> <label for="selectedCrime[5]" style="cursor: pointer;">Steal from another crew:</label> <select name=steal_crew> <option value="#">Select crew</option> <option value="#">---------------</option> <option>Event Horizon</option> <option>Ombra Di Lucifer</option> <option>The Order</option> <option>The Clenched Fist</option> <option>The Departed</option> <option>The Black Heart Rebellion</option> <option>Virtual Reality</option> <option>Strictly Business</option> <option>Trifecta</option> <option>The Black Birds</option> <option>The Rapture</option> <option>The Fraternity</option> <option>The Fatal Wounds</option> <option>Gossip Girl</option> <option>Infamous</option> </select> </td> <td>0% chance</td> </tr> <tr> <td align=right colspan=2><input type=submit value="Steal"></td> </tr> </table> </form> I have a script that opens IE, logs in and goes to "commit a crime". Now I want it to actually commit a crime, wait 2 minutes and commit a crime again, and do that over and over again. Anyone that can help me? Well I thought it worked, it did work for me, but for some reason doesn't work anymore. Now when I run the script, it opens IE and goes to bootleggers.us, and then presses the "Lost password" link. I think it has to do with the word "Password" being in that link. Anyone know how to fix my problem? Thanks in advance! EDIT: I am sorry, I forgot to put the code up! The username is: oDon The password is: uh0uxt9t Please only use this account for script testing purposes only! #include <IE.au3> $sUsername = "oDon" $sPassword = "uh0uxt9t" $sUrl = "http://www.bootleggers.us" $oIE = _IECreate ($sUrl) $oHWND = _IEPropertyGet($oIE, "hwnd") WinSetState ($oHWND, "", @SW_MAXIMIZE ) $oForm = _IEFormGetCollection ($oIE, 0) $oUsername = _IEFormElementGetObjByName ($oForm, "oDon") $oPassword = _IEFormElementGetObjByName ($oForm, "uh0uxt9t") _IEFormElementSetValue ($oUsername, $sUsername) _IEFormElementSetValue ($oPassword, $sPassword) _IEFormSubmit ($oForm) _IELinkClickByText ($oIE, "crimes") Edited April 16, 2010 by chappoian
kaotkbliss Posted April 13, 2010 Posted April 13, 2010 Unfortunately I cannot check the site out as my work blocks it. As long as there is no TOS or otherwise stated rules against automating the site, post some code and we'll help you get the problem figured out. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
chappoian Posted April 13, 2010 Author Posted April 13, 2010 Unfortunately I cannot check the site out as my work blocks it. As long as there is no TOS or otherwise stated rules against automating the site, post some code and we'll help you get the problem figured out.I Edited my post!
kaotkbliss Posted April 13, 2010 Posted April 13, 2010 I haven't used the IE functions as of yet, but according to the helpfile _IEFormElementGetObjByName ( ByRef $o_object, $s_name [, $i_index = 0] ) Where $s_name is the name of the element on the page. In your script you are looking for an element with the name of your username and password. This is probably wrong. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
chappoian Posted April 13, 2010 Author Posted April 13, 2010 I haven't used the IE functions as of yet, but according to the helpfile _IEFormElementGetObjByName ( ByRef $o_object, $s_name [, $i_index = 0] ) Where $s_name is the name of the element on the page. In your script you are looking for an element with the name of your username and password. This is probably wrong. Even when I change the code to: #include <IE.au3> $sUsername = "oDon" $sPassword = "uh0uxt9t" $sUrl = "http://www.bootleggers.us" $oIE = _IECreate ($sUrl) $oHWND = _IEPropertyGet($oIE, "hwnd") WinSetState ($oHWND, "", @SW_MAXIMIZE ) $oForm = _IEFormGetCollection ($oIE, 0) $oUsername = _IEFormElementGetObjByName ($oForm, "Username") $oPassword = _IEFormElementGetObjByName ($oForm, "Password") _IEFormElementSetValue ($oUsername, $sUsername) _IEFormElementSetValue ($oPassword, $sPassword) _IEFormSubmit ($oForm) _IELinkClickByText ($oIE, "crimes") With my username and password changed in: Username, Password. It does not work. Only when I already log in with my account in bootleggers with IE, it works. If you are not familiar with IE, you may change the code if it will work with anything else!
kaotkbliss Posted April 13, 2010 Posted April 13, 2010 I meant to say I am not familiar with the IE UDF. Anyways, are you sure that is what the internal names for those input fields are called? I think that is what you need. If I am right, you will need to view the HTML source and find the names in there. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
chappoian Posted April 13, 2010 Author Posted April 13, 2010 <tr> <td valign="top" width="216"><img src="http://img.bootleggers.us/game/login/new/bl.gif" width="216" height="138" alt="Login Image"></td> <td background="http://img.bootleggers.us/game/login/new/bc.gif" width="271" valign="top"> <table border="0" cellspacing="0" cellpadding="2" class="login" width="260"> <tr> <td align="center"> <input type="text" size="12" name="username" value="Username" onclick="clickClear(this, 'Username')" onblur="clickRecall(this, 'Username')"> </td> <td align="center"> <input type="password" size="12" name="password" value="Password" onfocus="clickClear(this, 'Password')" onclick="clickClear(this, 'Password')"> </td> <td align="center"> <input type="submit" value="Login"> </td> </tr> That is the Code. It says Password and Username
kaotkbliss Posted April 13, 2010 Posted April 13, 2010 Yep, it sure does... I will have to look into this when I get home and can open the site. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
JohnOne Posted April 13, 2010 Posted April 13, 2010 You really think its bright posting your username and password on a public forum ? AutoIt Absolute Beginners  Require a serial  Pause Script  Video Tutorials by Morthawt  ipify Monkey's are, like, natures humans.
chappoian Posted April 13, 2010 Author Posted April 13, 2010 It's a new account, do whit it what you want, I won't lose anything. + If anyone tries something stupid, I'll just ask for recovery password.
kaotkbliss Posted April 14, 2010 Posted April 14, 2010 Ok, I'm not sure why but... $oForm is not returning any result (checked with MsgBox) however, when I changed the value in $oForm = _IEFormGetCollection ($oIE, 0) to 2 like $oForm = _IEFormGetCollection ($oIE, 2) it seemed to log me in and do a couple things.... #include <IE.au3> $sUsername = "oDon" $sPassword = "uh0uxt9t" $sUrl = "http://www.bootleggers.us/" $oIE = _IECreate ($sUrl) $oHWND = _IEPropertyGet($oIE, "hwnd") WinSetState ($oHWND, "", @SW_MAXIMIZE ) $oForm = _IEFormGetCollection ($oIE, 2) $oUsername = _IEFormElementGetObjByName ($oForm, "Username") $oPassword = _IEFormElementGetObjByName ($oForm, "Password") _IEFormElementSetValue ($oUsername, $sUsername) _IEFormElementSetValue ($oPassword, $sPassword) _IEFormSubmit ($oForm) _IELinkClickByText ($oIE, "crimes") 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
chappoian Posted April 14, 2010 Author Posted April 14, 2010 (edited) Nice that works! Now what I tried to add, was: _IELinkClickByText ($oIE, "Beat up a Blind Man") _IEFormSubmit ($oForm) Sleep(12000) _IELinkClickByText ($oIE, "Beat up a Blind Man") _IEFormSubmit ($oForm) That did not work. Someone told me this: it has something to do with "onclick" from the page sourcecode The page source code is: <div style="width: 125px;" class="cat"><div style="height: 15px;" class="menu_header"> <img src="http://img.bootleggers.us/game/site/site/arrow.gif"> <a href="/logout.php?i=4335dc53bfd84f1985a851327852601d"><b>LOGOUT</b></a></div></div></td><td width=99% background="http://img.bootleggers.us/game/site/site/innerbg.gif" bgcolor="#222222" valign=top><br><center><table border="0" cellspacing="0" cellpadding="10" width="100%" class="cat"><tr><td><p style="font-size: 4pt;"> </p><center><form method="POST" action="/crime.php" name="f"><table width=500 cellspacing=0 cellpadding=2 border=1 bordercolor=black class=sub2 align=center><tr><td align=center class=header colspan=2>Minor Crimes</td></tr><tr><td width="375"><input type=radio name=select_crime value=2 id=radiocrime2><label id=labelcrime2 for=radiocrime2> Scare an Old Lady</label></td><td width="125">63% chance</td></tr><tr><td width="375"><input type=radio name=select_crime value=1 id=radiocrime1><label id=labelcrime1 for=radiocrime1> Beat up a Blind Man</label></td><td width="125">100% chance</td></tr><tr><td> </td><td align=right><input name=aCrime id=aCrime type=submit value="Commit"></td></tr></table><br><table width=500 cellspacing=0 cellpadding=2 border=1 bordercolor=black class=sub2 align=center><tr><td align=center class=header colspan=2>Major Crimes</td></tr><tr><td class=sub3 align=center><i>You need to get better at Minor Crimes first!</i></td></tr></table></form></center><p style="font-size: 4pt;"> </p></td></tr></table></td><td width=120 background="http://img.bootleggers.us/game/site/site/bg.gif" valign=top><div style="width: 125px;" class="cat"> I bolded out some noticeable things. So it I should use Radiocrim1, or Radiocrime2 if I want to select that action right? Edited April 14, 2010 by chappoian
kaotkbliss Posted April 14, 2010 Posted April 14, 2010 _IELinkClickByText may not work for that part because the crime name (if I remember correctly) is not a link. maybe _IEAction ( ByRef $o_object, "click" ) or _IEFormElementCheckBoxSelect might work better? 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
chappoian Posted April 14, 2010 Author Posted April 14, 2010 (edited) Sorry that I am asking so many questions, I am kinda new to this.I tried alot with _IEFormElementCheckBoxSelect. But couldn't figure it out. What do I have to type in the line exactly?This is the code information:<input type=radio name=select_crime value=1 id=radiocrime1><label id=labelcrime1 for=radiocrime1> Beat up a Blind Man</label></td><td width="125">100% chance</td></tr>This how it shows up on the page:Beat up a Blind ManAnd after that, can I just use the line: _IEFormSubmit ($oForm) and it will submit the crime? Edited April 14, 2010 by chappoian
kaotkbliss Posted April 14, 2010 Posted April 14, 2010 _IEFormElementCheckboxSelect ($oForm, "1", "", 1, "byValue") Should work, but I cannot test until I get home 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
chappoian Posted April 14, 2010 Author Posted April 14, 2010 _IEFormElementCheckboxSelect ($oForm, "1", "", 1, "byValue") Should work, but I cannot test until I get home Unfortunately it doesn't work. This is how my code looks like now: (I deleted the MAXIMIZE part.) #include <IE.au3> $sUsername = "oDon" $sPassword = "uh0uxt9t" $sUrl = "http://www.bootleggers.us/" $oIE = _IECreate ($sUrl) $oForm = _IEFormGetCollection ($oIE, 2) $oUsername = _IEFormElementGetObjByName ($oForm, "Username") $oPassword = _IEFormElementGetObjByName ($oForm, "Password") _IEFormElementSetValue ($oUsername, $sUsername) _IEFormElementSetValue ($oPassword, $sPassword) _IEFormSubmit ($oForm) _IELinkClickByText ($oIE, "crimes") _IEFormElementCheckboxSelect ($oForm, "1", "", 1, "byValue")
kaotkbliss Posted April 14, 2010 Posted April 14, 2010 A couple of things 1. I had the wrong command, it should have been _IEFormElementRadioSelect (I didn't even see that one) 2. had to reset the $oForm variable for the new page. #include <IE.au3> $sUsername = "oDon" $sPassword = "uh0uxt9t" $sUrl = "http://www.bootleggers.us/" $oIE = _IECreate ($sUrl) $oForm = _IEFormGetCollection ($oIE, 2) $oUsername = _IEFormElementGetObjByName ($oForm, "Username") $oPassword = _IEFormElementGetObjByName ($oForm, "Password") _IEFormElementSetValue ($oUsername, $sUsername) _IEFormElementSetValue ($oPassword, $sPassword) _IEFormSubmit ($oForm) _IELinkClickByText ($oIE, "crimes") $oForm = _IEFormGetCollection ($oIE, 0) _IEFormElementRadioSelect ($oForm, "1", "select_crime", 1, "byValue") _IEFormSubmit ($oForm) 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
chappoian Posted April 15, 2010 Author Posted April 15, 2010 A couple of things 1. I had the wrong command, it should have been _IEFormElementRadioSelect (I didn't even see that one) 2. had to reset the $oForm variable for the new page. #include <IE.au3> $sUsername = "oDon" $sPassword = "uh0uxt9t" $sUrl = "http://www.bootleggers.us/" $oIE = _IECreate ($sUrl) $oForm = _IEFormGetCollection ($oIE, 2) $oUsername = _IEFormElementGetObjByName ($oForm, "Username") $oPassword = _IEFormElementGetObjByName ($oForm, "Password") _IEFormElementSetValue ($oUsername, $sUsername) _IEFormElementSetValue ($oPassword, $sPassword) _IEFormSubmit ($oForm) _IELinkClickByText ($oIE, "crimes") $oForm = _IEFormGetCollection ($oIE, 0) _IEFormElementRadioSelect ($oForm, "1", "select_crime", 1, "byValue") _IEFormSubmit ($oForm) I changed the last line to: _IEFormElementRadioSelect ($oForm, "3", "radiocrime3", 1, "byValue") Now it selects the crime. When I add: _IEFormSubmit ($oForm), it does something, but does not complete the form. Check for yourself. Current code: #include <IE.au3> $sUsername = "oDon" $sPassword = "uh0uxt9t" $sUrl = "http://www.bootleggers.us/" $oIE = _IECreate ($sUrl) $oForm = _IEFormGetCollection ($oIE, 2) $oUsername = _IEFormElementGetObjByName ($oForm, "Username") $oPassword = _IEFormElementGetObjByName ($oForm, "Password") _IEFormElementSetValue ($oUsername, $sUsername) _IEFormElementSetValue ($oPassword, $sPassword) _IEFormSubmit ($oForm) _IELinkClickByText ($oIE, "crimes") $oForm = _IEFormGetCollection ($oIE, 0) _IEFormElementRadioSelect ($oForm, "3", "radiocrime3", 1, "byValue")bl.au3
kaotkbliss Posted April 15, 2010 Posted April 15, 2010 What I posted last worked for me. all you should have to do is... #include <IE.au3> $sUsername = "oDon" $sPassword = "uh0uxt9t" $sUrl = "http://www.bootleggers.us/" $oIE = _IECreate ($sUrl) $oForm = _IEFormGetCollection ($oIE, 2) $oUsername = _IEFormElementGetObjByName ($oForm, "Username") $oPassword = _IEFormElementGetObjByName ($oForm, "Password") _IEFormElementSetValue ($oUsername, $sUsername) _IEFormElementSetValue ($oPassword, $sPassword) _IEFormSubmit ($oForm) _IELinkClickByText ($oIE, "crimes") While 1 $oForm = _IEFormGetCollection ($oIE, 0) _IEFormElementRadioSelect ($oForm, "1", "select_crime", 1, "byValue") _IEFormSubmit ($oForm) Sleep(12000) WEnd and it will run forever 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
chappoian Posted April 15, 2010 Author Posted April 15, 2010 What I posted last worked for me. all you should have to do is... #include <IE.au3> $sUsername = "oDon" $sPassword = "uh0uxt9t" $sUrl = "http://www.bootleggers.us/" $oIE = _IECreate ($sUrl) $oForm = _IEFormGetCollection ($oIE, 2) $oUsername = _IEFormElementGetObjByName ($oForm, "Username") $oPassword = _IEFormElementGetObjByName ($oForm, "Password") _IEFormElementSetValue ($oUsername, $sUsername) _IEFormElementSetValue ($oPassword, $sPassword) _IEFormSubmit ($oForm) _IELinkClickByText ($oIE, "crimes") While 1 $oForm = _IEFormGetCollection ($oIE, 0) _IEFormElementRadioSelect ($oForm, "1", "select_crime", 1, "byValue") _IEFormSubmit ($oForm) Sleep(12000) WEnd and it will run forever Well it looks like it works, but if you look closely it actually does not complete the form. (It should say that the crime is committed and it was successful or not and then you'll have to wait for 2 minutes until you can commit your next crime. A countdown times will show). Now it selects the box and then does something, but not complete the form. Check for yourself.
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