feistcomputers Posted October 22, 2015 Share Posted October 22, 2015 I have be working on this stuff since april on my own and i'm about ready to call it quits. It should be possible to do. If your good at scripting. I'm getting better but need some help. I can get the clicks to work but not the timer. Want to save as much time as i can. so instead of a timer that goes way over what is needed to run the scan or scans, i want to apply this to many programs i use for computer cleanups in my shop. Can't get it to click next button when button becomes active again. any help much appreciated. Here is my code. The closing of the browsers isnt working muchless the image detection. Maybe its not getting to it. would be nice if it would show you where it go stuck. thankyou.expandcollapse popup#RequireAdmin ;Gives you admin rights ; By doing this you can have folder anywhere just as long as exe is in same folder as script. Run(@ScriptDir & '\CCleaner.exe') ; Always use this, it does mapping using the window versus the the whole screen, because every computer can have diff. resolutions. ; have to change it in the info getter too. options/coordmode/windows AutoItSetOption('MouseCoordMode', 0) While ProcessExists("iexplore.exe") ProcessClose("iexplore.exe") Sleep(100) WEnd While ProcessExists("safari.exe") ProcessClose("safari.exe") Sleep(100) WEnd While ProcessExists("microsoftedge.exe") ProcessClose("microsoftedge.exe") Sleep(100) WEnd While ProcessExists("firefox.exe") ProcessClose("firefox.exe") Sleep(100) WEnd While ProcessExists("chrome.exe") ProcessClose("chrome.exe") Sleep(100) WEnd ;Waits for our window to come up WinWait("Piriform CCleaner") ;When it see's it the windows gets activated right away. WinActivate("Piriform CCleaner") Sleep(900) ;primary means left click mouse, secondary means to right click. coord for where button is from info from mouse tab on into tool. 1 means 1 click. MouseClick('primary', 727, 530, 1, 0) #include <ImageSearch.au3> HotKeySet("p", "checkForImage") global $y = 0, $x = 0 Func checkForImage() Local $search = _ImageSearch('checkImage.bmp', 0, $x, $y, 0) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFunc while 1 sleep(200) WEnd WinWait("Piriform CCleaner") ;When it see's it the windows gets activated right away. WinActivate("Piriform CCleaner") Sleep(300) ;Application tab click. MouseClick('primary', 523, 151, 1, 0) Sleep(3000) MouseClick('primary', 275, 114, 1, 0) Sleep(344) WinWait("Piriform CCleaner") ;When it see's it the windows gets activated right away. WinActivate("Piriform CCleaner") MouseClick('primary', 716, 521, 1, 0) Sleep(3000) ;goto reg Send("!g") ;scan reg Send('!s') Sleep(3000) Send('!f') MouseClick('primary', 565, 520, 1, 0) ;scan reg Send('!s') Sleep(2000) Send('!f') MouseClick('primary', 565, 520, 1, 0) WinClose Link to comment Share on other sites More sharing options...
JohnOne Posted October 22, 2015 Share Posted October 22, 2015 Well for a start you have no error checking or debugging lines such as ConsoleWrite or MsgBox to indicate where you are in your script and what is failing.You could add this to top of script to begin with.Opt("TrayIconDebug", 1) ;0=no info, 1=debug line infoThen when you hover mouse over tray Icon, it will show in a tooltip what file and code line your script is at. feistcomputers 1 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...
Moderators JLogan3o13 Posted October 22, 2015 Moderators Share Posted October 22, 2015 @feistcomputers, why would you bang your head against the wall with Sends and Mouseclicks rather than using the command line parameters built into the product for you?https://www.piriform.com/docs/ccleaner/advanced-usage/command-line-parameters "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Bert Posted October 22, 2015 Share Posted October 22, 2015 The product only supports command line if it is the paid version. I think the free version is not command line supported The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 22, 2015 Moderators Share Posted October 22, 2015 @Bert you look to be correct Been a customer so long I forgot they don't support everything for the free version. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Bert Posted October 22, 2015 Share Posted October 22, 2015 I would think using controlclick would be more stable for what he is doing. Also using winlist to create an array to see what is open then going from there may be more streamline. Thoughts? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
kylomas Posted October 22, 2015 Share Posted October 22, 2015 This works for me using the free version...shellexecute("c:\program files\ccleaner\ccleaner.exe ","/auto")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...
feistcomputers Posted October 23, 2015 Author Share Posted October 23, 2015 I have used the auto and only goes like seven seconds. Much to quick, and in my mind since i can not see it i feel i'm not doing a good job on the cleanup. Once i get this time figured out it will spill over into all my tools i would like to automate. I just cant get past this. And i have like 5 other programs i want to do but dont want to move on until i finish this. So without using the command line i want to get this functioning with autoit. If there is a tutorial to watch please point me in the direction. I've tried different scripts but either i scripting it wrong or ccleaner is a bit tuff. what info would you guys need to help me figure this out Link to comment Share on other sites More sharing options...
JohnOne Posted October 23, 2015 Share Posted October 23, 2015 Your script stops doing anything here...while 1 sleep(200) WEnd 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...
feistcomputers Posted October 23, 2015 Author Share Posted October 23, 2015 (edited) I had found that script rummaging thru the forums. 2yrs old. How would i fix it. Now i'm blessed with errors. download beta config file to editor. Not sure if that is the answer or not. Didnt work. uuuugggggg Edited October 23, 2015 by feistcomputers Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 23, 2015 Moderators Share Posted October 23, 2015 @feistcomputers, if you want people to help you with code, please post code or link to where you found it. Posting a picture does not give us everything needed to help; worse, it forces someone trying to help you to type all the code out manually. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Bert Posted October 23, 2015 Share Posted October 23, 2015 Also, using image search with dll calls...I would not go there for what you need. I do not have time now but I will this evening. Let me see if I can come up with something that can solve your problem. No promises. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
JohnOne Posted October 23, 2015 Share Posted October 23, 2015 I had found that script rummaging thru the forums. 2yrs old. How would i fix it.Move what I posted to the end of your script. 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...
feistcomputers Posted October 24, 2015 Author Share Posted October 24, 2015 I think I got some of it. It seemed to click first but then goto registry tab and sit but i hadn't really got that far before. So I redid and hopefully fixed them all. But now it says. "D:\Shop-Server-Share\FC Scripts\CCleanerAuto\CCleaner.au3" (66) : ==> Duplicate function name.:Func checkForImage()Not sure tried to give same image a copy with diff name. Not sure what its telling me or if rest of the script works. Here it is.expandcollapse popupOpt("TrayIconDebug", 1) ;0=no info, 1=debug line info #RequireAdmin ;Give you admin rights ; By doing this you can have folder anywhere just as long as exe is in same folder as script. Run(@ScriptDir & '\CCleaner.exe') ; Always use this, it does mapping using the window versus the the whole screen, because every computer can have diff. resolutions. ; have to change it in the info getter too. options/coordmode/windows AutoItSetOption('MouseCoordMode', 0) While ProcessExists("iexplore.exe") ProcessClose("iexplore.exe") Sleep(100) WEnd While ProcessExists("safari.exe") ProcessClose("safari.exe") Sleep(100) WEnd While ProcessExists("microsoftedge.exe") ProcessClose("microsoftedge.exe") Sleep(100) WEnd While ProcessExists("firefox.exe") ProcessClose("firefox.exe") Sleep(100) WEnd While ProcessExists("chrome.exe") ProcessClose("chrome.exe") Sleep(100) WEnd ;Waits for our window to come up WinWait("Piriform CCleaner") ;When it see's it the windows gets activated right away. WinActivate("Piriform CCleaner") Sleep(3000) ;Clicking In Cleaner/Windows Tab, Run Cleaner button. MouseClick('primary', 727, 530, 1, 0) ;waits for Run Cleaner button to become blue & active again. #include <ImageSearch.au3> HotKeySet("p", "checkForImage") global $y = 0, $x = 0 Func checkForImage() Local $search = _ImageSearch('checkImage.bmp', 0, $x, $y, 0) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFunc WinWait("Piriform CCleaner") ;When it see's it the windows gets activated right away. WinActivate("Piriform CCleaner") Sleep(300) ;Application tab click. MouseClick('primary', 279,109, 1, 0) Sleep(3000) ;Clicking In Cleaner/Applications Tab, Run Cleaner button. MouseClick('primary', 727, 530, 1, 0) #include <ImageSearch.au3> HotKeySet("p", "checkForImage") global $y = 0, $x = 0 Func checkForImage() Local $search = _ImageSearch('checkImage1.bmp', 0, $x, $y, 0) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFunc ;goto registry Tab Send("!g") ;Push button "scan for issues" 1st scan of 2 Send('!s') ;waits for "Fix selected issues" button to become blue & active #include <ImageSearch.au3> HotKeySet("p", "checkForImage") global $y = 0, $x = 0 Func checkForImage() Local $search = _ImageSearch('fix.bmp', 0, $x, $y, 0) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFunc ;fix registry errors button Send('!f') Sleep(5000) ;Close button after fix MouseClick('primary', 239, 226, 1, 0) ;Push button "scan for issues" 2nd scan of 2 Send('!s') Sleep(2000) ;waits for "Fix selected issues" button to become blue & active #include <ImageSearch.au3> HotKeySet("p", "checkForImage") global $y = 0, $x = 0 Func checkForImage() Local $search = _ImageSearch('fix.bmp', 0, $x, $y, 0) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFunc ;fix registry errors button Send('!f') Sleep(5000) ;Close button after fix MouseClick('primary', 239, 226, 1, 0) WinClose while 1 sleep(200) WEnd Link to comment Share on other sites More sharing options...
JohnOne Posted October 24, 2015 Share Posted October 24, 2015 It's telling you the function is defined more than once in your script, remove or rename one of them. 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...
feistcomputers Posted October 25, 2015 Author Share Posted October 25, 2015 Hey John, I'm confused. I though you would have to put ;waits for Run Cleaner button to become blue & active again. #include <ImageSearch.au3> HotKeySet("p", "checkForImage") global $y = 0, $x = 0 Func checkForImage() Local $search = _ImageSearch('checkImage.bmp', 0, $x, $y, 0) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFuncevery time you wanted to search for a picture or new picture. Is this not correct. I want to thank you all to for helping me. I have spent so much time trying to get this to work since april. Doing it to save time, so i can start a virus removal and let it go. Spend more time with my kids instead of working on computers til after they go to bed. 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