NiwatiX Posted June 22, 2011 Share Posted June 22, 2011 Hello everybody, Im not a professional with autoit, im trying to figure out how to click on 3 buttons on a web page (minimized web page if possible, thats why im using controlclick and not mouseclick I want to be able to continue working, typing etc..). My problem is that I dont have any ID and the 3 buttons have the exact same name on it. Ive tryed MouseWheel("down",5) ; le scroll down Sleep (1000) ControlClick("[CLASS:Internet Explorer_Server; INSTANCE:2]", 765, 369) but that dont work so well .. nothing seems to happen This is the HTML code of the 3 button if it help you guys : <fieldset> <legend>#1 </legend> <form action="/index/voteGo" method="post" > <input type="hidden" name="id" id="id" value="1" /> <input type="button" value="Voter" onClick="this.disabled=true; this.form.submit();" /> </form><br /> </fieldset> <fieldset> <legend>#2 </legend> <form action="/index/voteGo" method="post" > <input type="hidden" name="id" id="id" value="2" /> <input type="button" value="Voter" onClick="this.disabled=true; this.form.submit();" /> </form><br /> </fieldset> <fieldset> <legend>#3 </legend> <form action="/index/voteGo" method="post" > <input type="hidden" name="id" id="id" value="3" /> <input type="button" value="Voter" onClick="this.disabled=true; this.form.submit();" /> </form><br /> </fieldset> If you guys could help me that would be very nice ^^ Link to comment Share on other sites More sharing options...
Tvern Posted June 22, 2011 Share Posted June 22, 2011 It'd be easier if you could give us a link to the page, but it sounds like you should use the _IE functions. You'll need to experiment, or inspect the page to get the right indices for the form/button you want to click. (just count the number of forms on the page starting at 0 to get the correct index) Then check which method of "clicking the button" works for you. This should give you something to work on: expandcollapse popup#include <IE.au3> _IEErrorHandlerRegister ("MyErrFunc") ;start IE hidden/visible. Global $sWebsite_URL = "www.somesite.com" ;Enter your url here. Global $oIE = _IECreate($sWebsite_URL,0,1) ;visible for testing, change "1" to "0" to make hidden. ;Get a reference to the form that contains the button you want to click Global $iIndex = 0 ;use the index of the form that contains the button you want to click. Global $oForm = _IEFormGetCollection($oIE,$iIndex) ;Try to click the button ;Option 1 _IEFormSubmit($oForm) ;Option 2 Global $oButton = _IEFormElementGetCollection($oForm,1) ;I believe 1 would be the correct index, needs to be checked though _IEAction($oButton,"click") ;Click the button ;Close IE when you're done, to avoid orphaned hidden IE windows. _IEQuit($oIE) _IEErrorHandlerDeregister () Func MyErrFunc() ; Important: the error object variable MUST be named $oIEErrorHandler $ErrorScriptline = $oIEErrorHandler.scriptline $ErrorNumber = $oIEErrorHandler.number $ErrorNumberHex = Hex($oIEErrorHandler.number, 8) $ErrorDescription = StringStripWS($oIEErrorHandler.description, 2) $ErrorWinDescription = StringStripWS($oIEErrorHandler.WinDescription, 2) $ErrorSource = $oIEErrorHandler.Source $ErrorHelpFile = $oIEErrorHandler.HelpFile $ErrorHelpContext = $oIEErrorHandler.HelpContext $ErrorLastDllError = $oIEErrorHandler.LastDllError $ErrorOutput = "" $ErrorOutput &= "--> COM Error Encountered in " & @ScriptName & @CR $ErrorOutput &= "----> $ErrorScriptline = " & $ErrorScriptline & @CR $ErrorOutput &= "----> $ErrorNumberHex = " & $ErrorNumberHex & @CR $ErrorOutput &= "----> $ErrorNumber = " & $ErrorNumber & @CR $ErrorOutput &= "----> $ErrorWinDescription = " & $ErrorWinDescription & @CR $ErrorOutput &= "----> $ErrorDescription = " & $ErrorDescription & @CR $ErrorOutput &= "----> $ErrorSource = " & $ErrorSource & @CR $ErrorOutput &= "----> $ErrorHelpFile = " & $ErrorHelpFile & @CR $ErrorOutput &= "----> $ErrorHelpContext = " & $ErrorHelpContext & @CR $ErrorOutput &= "----> $ErrorLastDllError = " & $ErrorLastDllError MsgBox(0,"COM Error", $ErrorOutput) SetError(1) Return EndFunc ;==>MyErrFunc Link to comment Share on other sites More sharing options...
NiwatiX Posted June 22, 2011 Author Share Posted June 22, 2011 tyvm for the help, there is so many diff functions in autoit ^^Your code is pretty cool I never tought to use the errfunc before, I learned a lot by reading it!I tryed to switch the number of the index from 1 to 15 and nothing special happen, the IE just close after 2 sec thats about itI will continue to experiment the code to try to find the indice I need btw this is the entire HTML code of the page, if that helpexpandcollapse popup<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link href="/css/global.css" media="screen" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="/js/jquery.js"></script> <script type="text/javascript" src="/js/global.js"></script> <title>Rawr</title> </head> <body> <!--[if lt IE 7]> <div style='border: 1px solid #F7941D; background: #FEEFDA; text-align: center; clear: both; height: 105px; position: relative;'> <div style='position: absolute; right: 3px; top: 3px; font-family: courier new; font-weight: bold;'><a href='#' onclick='javascript:this.parentNode.parentNode.style.display="none"; return false;'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-cornerx.jpg' style='border: none;' alt='Close this notice'/></a></div> <div style='width: 640px; margin: 0 auto; text-align: left; padding: 0; overflow: hidden; color: black;'> <div style='width: 75px; float: left;'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-warning.jpg' alt='Warning!'/></div> <div style='width: 275px; float: left; font-family: Arial, sans-serif;'> <div style='font-size: 14px; font-weight: bold; margin-top: 12px;'>Vous utilisez un navigateur dépassé depuis près de 8 ans!</div> <div style='font-size: 12px; margin-top: 6px; line-height: 12px;'>Ceci peut occasioner des <b>problèmes très graves</b> sur le site Merci de mettre à jour en choisissant un navigateur <b>gratuit</b> ci-contre .</div> </div> <div style='width: 75px; float: left;'><a href='http://fr.www.mozilla.com/fr/' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-firefox.jpg' style='border: none;' alt='Get Firefox 3.5'/></a></div> <div style='width: 75px; float: left;'><a href='http://www.microsoft.com/downloads/details.aspx?FamilyID=341c2ad5-8c3d-4347-8c03-08cdecd8852b&DisplayLang=fr' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-ie8.jpg' style='border: none;' alt='Get Internet Explorer 8'/></a></div> <div style='width: 73px; float: left;'><a href='http://www.apple.com/fr/safari/download/' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-safari.jpg' style='border: none;' alt='Get Safari 4'/></a></div> <div style='float: left;'><a href='http://www.google.com/chrome?hl=fr' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-chrome.jpg' style='border: none;' alt='Get Google Chrome'/></a></div> </div> </div> <![endif]--> <div id="haut-page"> <div id="haut"> <div id="zone_connec"> <div id="zone_connec_logon"> <p> Bonjour NIWATIX (<a href="/panel/deco/" >Deconnexion</a>) </p> </div> <form action="/index/auth" method="post" > <div id="zone_connec_form"> <div id="input_txt"> <p>Vous possèdez 29 point(s) <img src="/images/coins.png" /></p> </div> <div id="input_image"> </div> </form> </div> </div> </div> </div> <div id="page"> <div id="contenu"> <div id="header"></div> <div id="menu_h"> <div id="menu_container"> <div id="m1"><a href="/index/index/" >ACCUEIL</a></div> <div id="m2"><a href="/panel/addPoint/" >AJOUTER PTS</a></div> <div id="m3"><a href="/render/index/view/vote" >VOTER</a></div> <div id="m4"><a href="/panel/convertPoint/" >TOKEN</a></div> <div id="m5"><a href="" target="_blank">AIDE</a></div> </div> </div> <div id="centre"> <div id="menu_v"> <h1>INTERACTIF</h1> <ul> <li class="title"><a href="/panel/unlock/" >perso</a></li> <p>perso bloqué</p> <li class="title"><a href="/render/index/view/ban" >Liste</a></li> <p>IP</p> </ul> <h1>MON COMPTE</h1> <ul> <li class="title"><a href="/panel//" >Tableau de bord</a></li> <p>Votre centre de contrôle</p> <li class="title"><a href="/panel/addPoint/" >Ajouter des points </a></li> <p>Faite votre choix</p> <li class="title"><a href="/render/index/view/vote" >Votez</a></li> <p>Et gagnez jusqu'à 2 points!</p> <li class="title"><a href="/panel/convertPoint/" >Tokens</a></li> <p>boutique ;)</p> </ul> <h1>AD</h1> <ul> <li class="title"><a href="" target="_blank">aide</a></li> <p>Retrouvez ici rapidement de l'aide pour résoudre vos problèmes</p> </ul> <h1>COMMUNAUTE</h1> <ul> <li class="title"><a href="/index/index/" >News</a> <img src="/images/rss.gif" /></li> <p>Toute l'actu</p> <li class="title"><a href="/forum" target="_blank">Forum</a></li> <p>Accèder à notre lieu de discussion</p> <li class="title"><a href="/render/index/view/ts" >Serveur Vocal</a></li> <p>Tutoriel TeamSpeak3, Venez discuter!</p> </ul> <h1>CHARTES</h1> <ul> <li class="title"><a href="/render/index/view/charteUser" >Charte</a></li> <p>Conditions d'utilisations</p> <li class="title"><a href="/render/index/view/charteMJ" >Charte</a></li> <p>Charte</p> </ul> <div style="width:120px; height:600px; margin-left:auto; margin-right:auto;"> <script type="text/javascript"><!-- google_ad_client = "pub-4549698150860746"; /* Pub Index */ google_ad_slot = "3351737646"; google_ad_width = 120; google_ad_height = 600; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div> </div> <div id="content"> <div style="margin-left:14px;"> <img src="/images/presentation.gif" /> </div> <div id="content_header"></div> <div id="content_content"> <h1>Voter</h1> <p> Voter toutes les deux heures vous permez de gagner des points . </p> <p class="alert"> Ces Root-Top sont equipés d'un anti-cheat </p> <fieldset> <legend> #1 (1 vote = 1 point)</legend> <form action="/index/voteGo" method="post" > <input type="hidden" name="id" id="id" value="1" /> <input type="button" value="Voter" onClick="this.disabled=true; this.form.submit();" /> </form><br /> </fieldset> <fieldset> <legend> #2 (1 vote = 2 point)</legend> <form action="/index/voteGo" method="post" > <input type="hidden" name="id" id="id" value="2" /> <input type="button" value="Voter" onClick="this.disabled=true; this.form.submit();" /> </form><br /> </fieldset> <fieldset> <legend> #3 (1 vote = 0.5 point)</legend> <form action="/index/voteGo" method="post" > <input type="hidden" name="id" id="id" value="3" /> <input type="button" value="Voter" onClick="this.disabled=true; this.form.submit();" /> </form><br /> </fieldset> <br /> <div class="clear"></div> </div> <div id="content_footer"></div> </div> <div class="clear"></div> <div id="footer"></div> </div> </div> </div> <div id="mention"> © 2009-2010 - Tous droits réservés.<br /> </div> <div id="xiti-logo" style="width:80px; margin-left:auto; margin-right:auto;"> <script type="text/javascript"> <!-- document.write('<a href="http://www.xiti.com/xiti.asp?s=357410" title="WebAnalytics">'); Xt_param = 's=357410&p='; try {Xt_r = top.document.referrer;} catch(e) {Xt_r = document.referrer; } Xt_h = new Date(); Xt_i = '<img width="80" height="15" border="0" '; Xt_i += 'src="http://logv145.xiti.com/g.xiti?'+Xt_param; Xt_i += '&hl='+Xt_h.getHours()+'x'+Xt_h.getMinutes()+'x'+Xt_h.getSeconds(); if(parseFloat(navigator.appVersion)>=4) {Xt_s=screen;Xt_i+='&r='+Xt_s.width+'x'+Xt_s.height+'x'+Xt_s.pixelDepth+'x'+Xt_s.colorDepth;} document.write(Xt_i+'&ref='+Xt_r.replace(/[<>"]/g, '').replace(/&/g, '$')+'"></a>'); //--> </script> <noscript> <div id="xiti-logo-noscript"> <a href="http://www.xiti.com/xiti.asp?s=357410" title="WebAnalytics" >WebAnalytics solution by <img width="80" height="15" src="http://logv145.xiti.com/g.xiti?s=357410&p=&" alt="WebAnalytics" /></a> </div> </noscript> </div>This is an inspect directly on a button ->thx again for the help ^^ Link to comment Share on other sites More sharing options...
NiwatiX Posted June 28, 2011 Author Share Posted June 28, 2011 yea Im trying to get this working for 6 days now Do you guys think it could be impossible to do that with autoit maybe? 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