adz89 Posted March 24, 2009 Share Posted March 24, 2009 Right Im very lazy, so I'm writing a script so that when I press space on the keyboard, the script clicks a button on this website! Its a paid clicking website, but my mouse on my laptop is stupid and I like to avoid using it whenever possible! Anyway the script I've got so far is below, I get as far as opening the 'remote control' but it can't find the button to click, I want to click the 'surf now' button (You'll see if you log into the tester account I've created). I think its an IFrame, but I can't work the stupid things... Can anyone help? Please? I've tried everything that I know of to get it to work! expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.13.7 (beta) Author: Adam Rees Script Function: Make me money on clickthru Hot Keys: Pause - Pauses the script Shift + ESC - Terminates the script #ce ---------------------------------------------------------------------------- #RequireAdmin #include <IE.au3> Global $Paused HotKeySet("{PAUSE}", "Togglepause") HotKeySet("+{ESC}", "Terminate") $oIE=_IECreate("http://clickthru.com",0,1,1) $oForm = _IEFormGetCollection($oIE, 0) $oUser = _IEFormElementGetObjByName($oForm,"email") $oPassword = _IEFormElementGetObjByName($oForm,"passwd") $oPage = _IEFormElementGetObjByName($oForm,"dest") $oLogin = _IEFormElementGetObjByName($oForm,"submit") _IEFormElementSetValue($oUser,"TESTER1") _IEFormElementSetValue($oPassword,"tester123456") _IEFormElementOptionselect($oPage,"link") _IEFormSubmit($oForm) ;Form has been submitted, now we wait for it to load then click on the "surf now" button _IELoadWait($oIE) ;This is the bit that doesn't work!!!! $oRemote=_IEFrameGetObjByName($oIE,"CTNnav") _IENavigate($oRemote,"http://www.clickthru.net/link?id=&tgt=&uid=616883&seq=&cc=0&fm=1&tm=KWC&tm=V") _IELoadWait($oRemote) ;These are the hot keys set for the script Func Togglepause() $Paused = Not $Paused While $Paused Sleep(10) ToolTip("Paused",0,0) WEnd ToolTip("") EndFunc Func Terminate() MsgBox(64,"Attention","Program Terminated, Internet Explorer will now close") _IEQuit($oIE) Exit 0 EndFunc Self confessed noob... Link to comment Share on other sites More sharing options...
Authenticity Posted March 24, 2009 Share Posted March 24, 2009 Can you post the html source please? Link to comment Share on other sites More sharing options...
Negative1 Posted March 24, 2009 Share Posted March 24, 2009 (edited) _IEFormSubmit($oForm,0) ;Form has been submitted, now we wait for it to load then click on the "surf now" button _IELoadWait($oIE) $oRemote=_IEFrameGetObjByName($oIE,"CTNnav") _IELinkClickByindex($oRemote,3) ;link click by index not navigate. _IELoadWait($oRemote) Notice the change to form submit with the ,0 arg. For some reason your program wasn't getting past this point. The other issue is that when you used _IENavigate you were trying to open the link directly instead of clicking on the button on the remote. Hope this helps it worked for me. -1 Edited March 24, 2009 by Negative1 What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world. Link to comment Share on other sites More sharing options...
adz89 Posted March 25, 2009 Author Share Posted March 25, 2009 _IEFormSubmit($oForm,0) ;Form has been submitted, now we wait for it to load then click on the "surf now" button _IELoadWait($oIE) $oRemote=_IEFrameGetObjByName($oIE,"CTNnav") _IELinkClickByindex($oRemote,3);link click by index not navigate. _IELoadWait($oRemote) Notice the change to form submit with the ,0 arg. For some reason your program wasn't getting past this point. The other issue is that when you used _IENavigate you were trying to open the link directly instead of clicking on the button on the remote. Hope this helps it worked for me. -1 Yeah, I tried going about finding the button then clicking it, but when that didn't work, I tried loading the link directly, but that didn't work either... I've had no luck with this one... Does anyone know what I can do? Thanks in advance Self confessed noob... Link to comment Share on other sites More sharing options...
Negative1 Posted March 25, 2009 Share Posted March 25, 2009 Yeah, I tried going about finding the button then clicking it, but when that didn't work, I tried loading the link directly, but that didn't work either... I've had no luck with this one... Does anyone know what I can do? Thanks in advance The changes to the code I posted don't work for you? Here is the full post of your code with the changes: expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.13.7 (beta) Author: Adam Rees Script Function: Make me money on clickthru Hot Keys: Pause - Pauses the script Shift + ESC - Terminates the script #ce ---------------------------------------------------------------------------- #RequireAdmin #include <IE.au3> Global $Paused HotKeySet("{PAUSE}", "Togglepause") HotKeySet("+{ESC}", "Terminate") $oIE=_IECreate("http://clickthru.com",0,1,1) $oForm = _IEFormGetCollection($oIE, 0) $oUser = _IEFormElementGetObjByName($oForm,"email") $oPassword = _IEFormElementGetObjByName($oForm,"passwd") $oPage = _IEFormElementGetObjByName($oForm,"dest") ;$oLogin = _IEFormElementGetObjByName($oForm,"submit") ;Note: I could not find anything called "submit" in the HTML source and this was giving an error. _IEFormElementSetValue($oUser,"TESTER1") _IEFormElementSetValue($oPassword,"tester123456") _IEFormElementOptionselect($oPage,"link") _IEFormSubmit($oForm,0) ;Form has been submitted, now we wait for it to load then click on the "surf now" button _IELoadWait($oIE) $oRemote=_IEFrameGetObjByName($oIE,"CTNnav") _IELinkClickByindex($oRemote,3);link click by index not by navigate. _IELoadWait($oRemote) ;These are the hot keys set for the script Func Togglepause() $Paused = Not $Paused While $Paused Sleep(10) ToolTip("Paused",0,0) WEnd ToolTip("") EndFunc Func Terminate() MsgBox(64,"Attention","Program Terminated, Internet Explorer will now close") _IEQuit($oIE) Exit 0 EndFunc What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world. Link to comment Share on other sites More sharing options...
adz89 Posted March 25, 2009 Author Share Posted March 25, 2009 The changes to the code I posted don't work for you? Here is the full post of your code with the changes: expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.13.7 (beta) Author: Adam Rees Script Function: Make me money on clickthru Hot Keys: Pause - Pauses the script Shift + ESC - Terminates the script #ce ---------------------------------------------------------------------------- #RequireAdmin #include <IE.au3> Global $Paused HotKeySet("{PAUSE}", "Togglepause") HotKeySet("+{ESC}", "Terminate") $oIE=_IECreate("http://clickthru.com",0,1,1) $oForm = _IEFormGetCollection($oIE, 0) $oUser = _IEFormElementGetObjByName($oForm,"email") $oPassword = _IEFormElementGetObjByName($oForm,"passwd") $oPage = _IEFormElementGetObjByName($oForm,"dest") ;$oLogin = _IEFormElementGetObjByName($oForm,"submit");Note: I could not find anything called "submit" in the HTML source and this was giving an error. _IEFormElementSetValue($oUser,"TESTER1") _IEFormElementSetValue($oPassword,"tester123456") _IEFormElementOptionselect($oPage,"link") _IEFormSubmit($oForm,0) ;Form has been submitted, now we wait for it to load then click on the "surf now" button _IELoadWait($oIE) $oRemote=_IEFrameGetObjByName($oIE,"CTNnav") _IELinkClickByindex($oRemote,3);link click by index not by navigate. _IELoadWait($oRemote) ;These are the hot keys set for the script Func Togglepause() $Paused = Not $Paused While $Paused Sleep(10) ToolTip("Paused",0,0) WEnd ToolTip("") EndFunc Func Terminate() MsgBox(64,"Attention","Program Terminated, Internet Explorer will now close") _IEQuit($oIE) Exit 0 EndFunc I just ran the script and it got as far as the remote, then it did nothing, IE said it was 'done' and the script icon was just sitting there, nothing happened after logging in! Does the script work for you? The login details are for an actual tester account. Self confessed noob... Link to comment Share on other sites More sharing options...
Negative1 Posted March 25, 2009 Share Posted March 25, 2009 (edited) I just ran the script and it got as far as the remote, then it did nothing, IE said it was 'done' and the script icon was just sitting there, nothing happened after logging in! Does the script work for you? The login details are for an actual tester account.Yeah it works... the server is slow today but it clicks "surf" then after a bit a random webpage shows up on the right hand frame. Maybe i misunderstand the purpose but this is what its suppose to do right?Edit: Internet Explorer V. 6.0.2900.5512 SP 3 Edited March 25, 2009 by Negative1 What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world. Link to comment Share on other sites More sharing options...
adz89 Posted March 25, 2009 Author Share Posted March 25, 2009 (edited) Yeah it works... the server is slow today but it clicks "surf" then after a bit a random webpage shows up on the right hand frame. Maybe i misunderstand the purpose but this is what its suppose to do right?Edit: Internet Explorer V. 6.0.2900.5512 SP 3Yeah thats what its supposed to do, hang on, let me try again, I may have copied the script wrong... :SIt works perfectly now, thank you! Hopefully the whole script will work after I finish it!Thanks for all your help Edited March 25, 2009 by adz89 Self confessed noob... Link to comment Share on other sites More sharing options...
Negative1 Posted March 25, 2009 Share Posted March 25, 2009 Yeah thats what its supposed to do, hang on, let me try again, I may have copied the script wrong... :SIt works perfectly now, thank you! Hopefully the whole script will work after I finish it!Thanks for all your helpGlad to here. Good luck on the rest. What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world. Link to comment Share on other sites More sharing options...
adz89 Posted March 25, 2009 Author Share Posted March 25, 2009 Right I'm going to be a right pain in the arse here, I want to click the good button... Can you tell me how you got the script to locate the buttons? I assume you use the same procedure to click the 'surf now' button? But with a different number for linkclickbyindex? Sorry, I must sound like a complete noob... Self confessed noob... Link to comment Share on other sites More sharing options...
Negative1 Posted March 25, 2009 Share Posted March 25, 2009 Right I'm going to be a right pain in the arse here, I want to click the good button... Can you tell me how you got the script to locate the buttons? I assume you use the same procedure to click the 'surf now' button? But with a different number for linkclickbyindex? Sorry, I must sound like a complete noob... Intial observation is that the good and bad button cannot be clicked by index. The total number of links on the remote = 10 according to: $oLinks = _IELinkGetCollection ($oRemote) $iNumLinks = @extended MsgBox(0, "Link Info", $iNumLinks & " links found") But you can clearly count 12 total buttons. I'm not very experienced in scripting IE but that is my guess. What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world. Link to comment Share on other sites More sharing options...
DaleHohm Posted March 25, 2009 Share Posted March 25, 2009 Use _IEGetObjByName and _IEAction "click" 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...
adz89 Posted March 26, 2009 Author Share Posted March 26, 2009 (edited) Use _IEGetObjByName and _IEAction "click" That method doesn't work, neither does _IEimgclick, It just doesn't wanna find the button! Here's the code Im working off at the moment: expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.13.7 (beta) Author: Adam Rees Script Function: Help to make me money on clickthru Hot Keys: Pause - Pauses the script Shift + ESC - Terminates the script #ce ---------------------------------------------------------------------------- #RequireAdmin #include <IE.au3> Global $Paused HotKeySet("{PAUSE}", "Togglepause") HotKeySet("+{ESC}", "Terminate") $oIE=_IECreate("http://clickthru.com",0,1,1) $oForm = _IEFormGetCollection($oIE, 0) $oUser = _IEFormElementGetObjByName($oForm,"email") $oPassword = _IEFormElementGetObjByName($oForm,"passwd") $oPage = _IEFormElementGetObjByName($oForm,"dest") _IEFormElementSetValue($oUser,"TESTER1") _IEFormElementSetValue($oPassword,"tester123456") _IEFormElementOptionselect($oPage,"link") _IEFormSubmit($oForm,0) ;Form has been submitted, now we wait for it to load then click on the "surf now" button _IELoadWait($oIE) $oRemote=_IEFrameGetObjByName($oIE,"CTNnav") _IELinkClickByindex($oRemote,3) _IELoadWait($oRemote) $oGood=_IEImgClick($oRemote,"good","name") ;These are the hot keys set for the script Func Togglepause() $Paused = Not $Paused While $Paused Sleep(10) ToolTip("Paused",0,0) WEnd ToolTip("") EndFunc Func Terminate() MsgBox(64,"Attention","Program Terminated, Internet Explorer will now close") _IEQuit($oIE) Exit 0 EndFunc Edited March 26, 2009 by adz89 Self confessed noob... 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