engjcowi Posted September 22, 2010 Share Posted September 22, 2010 Hi GuysI've been working on a program for myself to take care of my pc automatically. I created this script for the portable version of superantispyware which can be found here SAS Portable. The program needs to be in the same directory as the script dont worry about the name the script will figure it out so just leave the sas filename as it is after download.Ive used it a few times now and come accross the odd error. It seems on Vista and 7 then it continually loops, i.e it scans and completes the removal etc then re scans and keeps in that same loop. It doesnt seem to do it on xp though. If possible could you guys please have a look at my code, test it out yourselves so i can perfect it and then release it into the example scripts for everyones use.ThanksJamieexpandcollapse popup;set up vars Local $sasportexe, $sasportrun ;find the full file name as ver numbers may change $sasportexe = FileFindFirstFile(@ScriptDir & '\sas*.com') $sasportrun = FileFindNextFile($sasportexe) ;set the file name as file to run FileClose($sasportexe);close the search handle ;run the program Run(@ScriptDir & "\health\" & $sasportrun) Sleep(4000) ; Wait for SAS to start ALL SLEEP FUNCTIONS NEEDED DO NOT REMOVE!!!!! ;inital welcome screen WinActivate("Portable Launcher", "Click here to start") WinWaitActive("Portable Launcher", "Click here to start") ControlClick("Portable Launcher","Click here to start",1) sleep(3000) If WinExists("SUPERAntiSpyware Language Selection", "OK") Then WinActivate("SUPERAntiSpyware Language Selection", "OK") WinWaitActive("SUPERAntiSpyware Language Selection", "OK") ControlClick("SUPERAntiSpyware Language Selection","OK",1) sleep(2500) EndIf ;sets up the loop while superantispyware is running - when the program closes it will end the loop While ProcessExists("program.com") ;selects the language on selection screen ;from main menu this selects the scan button If WinExists("SUPERAntiSpyware", "scan") Then WinActivate("SUPERAntiSpyware", "scan") WinWaitActive("SUPERAntiSpyware", "scan") ControlClick("SUPERAntiSpyware","Scan your Computer...",1090) sleep(1000) EndIf ;Selects a full scan option If WinExists("SUPERAntiSpyware", "scan") Then WinActivate("SUPERAntiSpyware", "scan") WinWaitActive("SUPERAntiSpyware", "scan") ControlClick("SUPERAntiSpyware","Perform Custom Scan",1073) ;Select full scan change to 1074 for custom scan and testing code below sleep(1000) EndIf ;can delete if wanted -was used for testing as selected custom scan (see comment just above). unchecks selected folders and runs custom with memory and cookies selection for speed #cs If WinExists("SUPERAntiSpyware", "scan") Then WinActivate("SUPERAntiSpyware", "scan") WinWaitActive("SUPERAntiSpyware", "scan") ControlClick("SUPERAntiSpyware","Selected Folders",1004) ;oring 1073 sleep(1000) EndIf If WinExists("SUPERAntiSpyware", "scan") Then WinActivate("SUPERAntiSpyware", "scan") WinWaitActive("SUPERAntiSpyware", "scan") ControlClick("SUPERAntiSpyware","Perform Custom Scan",1074) ;oring 1073 sleep(1000) EndIf #ce ;clicks next button once full scan is selected If WinExists("SUPERAntiSpyware", "Perform Complete Scan") Then WinActivate("SUPERAntiSpyware", "Perform Complete Scan") WinWaitActive("SUPERAntiSpyware", "Perform Complete Scan") ControlClick("SUPERAntiSpyware","&Next >",12324) sleep(1000) EndIf ;once scan is co,mpleted summary box opens and clicks to progress to removal screen If WinExists("SUPERAntiSpyware Scan Summary", "Potentially harmful items") Then WinActivate("SUPERAntiSpyware Scan Summary", "Potentially harmful items") WinWaitActive("SUPERAntiSpyware Scan Summary", "Potentially harmful items") ControlClick("SUPERAntiSpyware Scan Summary","Potentially harmful items",1) sleep(1000) EndIf ;nothing found and close If WinExists("SUPERAntiSpyware", "OK") Then WinActivate("SUPERAntiSpyware", "OK") WinWaitActive("SUPERAntiSpyware", "OK") ControlClick("SUPERAntiSpyware","OK",2) sleep(1000) ProcessClose("program.com") sleep(1000) ProcessClose("program.com") ;sometimes multiple instance found so double close added EndIf ;all spyware already checked by program so clicks ok to remove found spyware If WinExists("SUPERAntiSpyware", "Place a checkmark next to the items you wish to") Then WinActivate("SUPERAntiSpyware", "Place a checkmark next to the items you wish to") WinWaitActive("SUPERAntiSpyware", "Place a checkmark next to the items you wish to") ControlClick("SUPERAntiSpyware","&Next >",12324) sleep(1000) LogState("Spyware found and removed") ; writes in the log that spyware was found and removed $sasmal = 1 ; for cust report as above EndIf ;stops restart - restart will be required at some point If WinExists("SUPERAntiSpyware", "You must reboot to complete the remova") Then WinActivate("SUPERAntiSpyware", "You must reboot to complete the remova") WinWaitActive("SUPERAntiSpyware", "You must reboot to complete the remova") send("!N") sleep(1000) ;ControlClick("SUPERAntiSpyware","&Next >",12324) EndIf ;stops restart - restart will be required at some point and say ok i understand restart required If WinExists("SUPERAntiSpyware", "Your system is still infected, you must reboot") Then WinActivate("SUPERAntiSpyware", "Your system is still infected, you must reboot") WinWaitActive("SUPERAntiSpyware", "Your system is still infected, you must reboot") ControlClick("SUPERAntiSpyware","OK",2) sleep(1000) ProcessClose("superantispyware.exe") ProcessClose("program.com") EndIf ;clicks finish once spyware removed - If WinExists("SUPERAntiSpyware", "<B>Quarantined and Removed Items") Then WinActivate("SUPERAntiSpyware", "<B>Quarantined and Removed Items") WinWaitActive("SUPERAntiSpyware", "<B>Quarantined and Removed Items") ControlClick("SUPERAntiSpyware","Finish",12325) ProcessClose("superantispyware.exe") ProcessClose("program.com") EndIf Sleep(500) ; let the computer do something WEnd Drunken Frat-Boy Monkey Garbage Link to comment Share on other sites More sharing options...
engjcowi Posted September 24, 2010 Author Share Posted September 24, 2010 anyone even looked at it? Drunken Frat-Boy Monkey Garbage Link to comment Share on other sites More sharing options...
LurchMan Posted September 25, 2010 Share Posted September 25, 2010 What exactly does it do in XP for you? Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end. Link to comment Share on other sites More sharing options...
engjcowi Posted September 25, 2010 Author Share Posted September 25, 2010 each time ive ran it in xp it starts a full scan, completes the scan, removes any malware then closes. In vista and 7 it seems to repeat the scan over and over. Drunken Frat-Boy Monkey Garbage Link to comment Share on other sites More sharing options...
JohnOne Posted September 25, 2010 Share Posted September 25, 2010 I'm not going to run that on my system, as I dont want it removing things I dont want it to. Perhaps vista and 7 need different privilages to close certain windows and processes, so "program.com" may not be getting closed, so always exists, hense it wont stop. Try adding #RequireAdmin to the top 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...
engjcowi Posted October 23, 2010 Author Share Posted October 23, 2010 Hi Guys i was wondering if anyone had used this script and if they had encountered any errors or had any suggestions thanks Drunken Frat-Boy Monkey Garbage Link to comment Share on other sites More sharing options...
vmlinux Posted June 16, 2011 Share Posted June 16, 2011 Hi Guys i was wondering if anyone had used this script and if they had encountered any errors or had any suggestionsthanksNice script, I like it. You just need to make it so you also kill PROGRAM64.COM as well, because that's what it runs in a 64 bit environment. I think that's what was causing your loops Link to comment Share on other sites More sharing options...
vmlinux Posted June 16, 2011 Share Posted June 16, 2011 Nice script, I like it. You just need to make it so you also kill PROGRAM64.COM as well, because that's what it runs in a 64 bit environment. I think that's what was causing your loops Here's what I have so far, it would also be possible to have the program update the executable, or attempt to before running it: expandcollapse popup;set up vars Local $sasportexe, $sasportrun, $scriptdr ;Get running folder, add trailing backslash $scriptdr = (@ScriptDir & '\') ;find the full file name as ver numbers may change $sasportexe = FileFindFirstFile($scriptdr & 'sas*.com') ;msgbox(0,"test1",$scriptdr & 'sas*.com') ;msgbox(0,"test2",$sasportexe) $sasportrun = FileFindNextFile($sasportexe) ;set the file name as file to run ;msgbox(0,"test3",$sasportrun) FileClose($sasportexe);close the search handle ;run the program Run($scriptdr & $sasportrun) ;msgbox(0,"test4",$scriptdr & $sasportrun) Sleep(4000) ; Wait for SAS to start ALL SLEEP FUNCTIONS NEEDED DO NOT REMOVE!!!!! ;inital welcome screen WinActivate("Portable Launcher", "Click here to start") WinWaitActive("Portable Launcher", "Click here to start") ControlClick("Portable Launcher","Click here to start",1) sleep(3000) If WinExists("SUPERAntiSpyware Language Selection", "OK") Then WinActivate("SUPERAntiSpyware Language Selection", "OK") WinWaitActive("SUPERAntiSpyware Language Selection", "OK") ControlClick("SUPERAntiSpyware Language Selection","OK",1) sleep(2500) EndIf ;sets up the loop while superantispyware is running - when the program closes it will end the loop While ProcessExists(("PROGRAM64.COM") or ("PROGRAM.COM")) ;selects the language on selection screen ;from main menu this selects the scan button If WinExists("SUPERAntiSpyware Free Edition", "Scan your Computer") Then WinActivate("SUPERAntiSpyware Free Edition", "Scan your Computer") WinWaitActive("SUPERAntiSpyware Free Edition", "Scan your Computer") ControlClick("SUPERAntiSpyware Free Edition","Scan your Computer...",1090) sleep(1000) EndIf ;Selects a full scan option If WinExists("SUPERAntiSpyware", "scan") Then WinActivate("SUPERAntiSpyware", "scan") WinWaitActive("SUPERAntiSpyware", "scan") ControlClick("SUPERAntiSpyware","Perform Custom Scan",1073) ;Select full scan change to 1074 for custom scan and testing code below sleep(1000) EndIf ;can delete if wanted -was used for testing as selected custom scan (see comment just above). unchecks selected folders and runs custom with memory and cookies selection for speed #cs If WinExists("SUPERAntiSpyware", "scan") Then WinActivate("SUPERAntiSpyware", "scan") WinWaitActive("SUPERAntiSpyware", "scan") ControlClick("SUPERAntiSpyware","Selected Folders",1004) ;oring 1073 sleep(1000) EndIf If WinExists("SUPERAntiSpyware", "scan") Then WinActivate("SUPERAntiSpyware", "scan") WinWaitActive("SUPERAntiSpyware", "scan") ControlClick("SUPERAntiSpyware","Perform Custom Scan",1074) ;oring 1073 sleep(1000) EndIf #ce ;clicks next button once full scan is selected If WinExists("SUPERAntiSpyware", "Perform Complete Scan") Then WinActivate("SUPERAntiSpyware", "Perform Complete Scan") WinWaitActive("SUPERAntiSpyware", "Perform Complete Scan") ControlClick("SUPERAntiSpyware","&Next >",12324) sleep(1000) EndIf ;once scan is co,mpleted summary box opens and clicks to progress to removal screen If WinExists("SUPERAntiSpyware Scan Summary", "Potentially harmful items") Then WinActivate("SUPERAntiSpyware Scan Summary", "Potentially harmful items") WinWaitActive("SUPERAntiSpyware Scan Summary", "Potentially harmful items") ControlClick("SUPERAntiSpyware Scan Summary","Potentially harmful items",1) sleep(1000) EndIf ;nothing found and close If WinExists("SUPERAntiSpyware", "OK") Then WinActivate("SUPERAntiSpyware", "OK") WinWaitActive("SUPERAntiSpyware", "OK") ControlClick("SUPERAntiSpyware","OK",2) sleep(1000) ProcessClose("PROGRAM64.COM") sleep(1000) ProcessClose("PROGRAM.COM") sleep(1000) ProcessClose("PROGRAM64.COM") sleep(1000) ProcessClose("PROGRAM.COM") ;sometimes multiple instance found so double close added EndIf ;all spyware already checked by program so clicks ok to remove found spyware If WinExists("SUPERAntiSpyware", "Place a checkmark next to the items you wish to") Then WinActivate("SUPERAntiSpyware", "Place a checkmark next to the items you wish to") WinWaitActive("SUPERAntiSpyware", "Place a checkmark next to the items you wish to") ControlClick("SUPERAntiSpyware","&Next >",12324) sleep(1000) ;LogState("Spyware found and removed") ; writes in the log that spyware was found and removed $sasmal = 1 ; for cust report as above EndIf ;stops restart - restart will be required at some point If WinExists("SUPERAntiSpyware", "You must reboot to complete the remova") Then WinActivate("SUPERAntiSpyware", "You must reboot to complete the remova") WinWaitActive("SUPERAntiSpyware", "You must reboot to complete the remova") send("!N") sleep(1000) ;ControlClick("SUPERAntiSpyware","&Next >",12324) EndIf ;stops restart - restart will be required at some point and say ok i understand restart required If WinExists("SUPERAntiSpyware", "Your system is still infected, you must reboot") Then WinActivate("SUPERAntiSpyware", "Your system is still infected, you must reboot") WinWaitActive("SUPERAntiSpyware", "Your system is still infected, you must reboot") ControlClick("SUPERAntiSpyware","OK",2) sleep(1000) ProcessClose("superantispyware.exe") ProcessClose("PROGRAM64.COM") ProcessClose("PROGRAM.COM") EndIf ;clicks finish once spyware removed - If WinExists("SUPERAntiSpyware", "<B>Quarantined and Removed Items") Then WinActivate("SUPERAntiSpyware", "<B>Quarantined and Removed Items") WinWaitActive("SUPERAntiSpyware", "<B>Quarantined and Removed Items") MsgBox(1,"test","trying to close app") ControlClick("SUPERAntiSpyware","Close",12325) ProcessClose("superantispyware.exe") ProcessClose("PROGRAM64.COM") ProcessClose("PROGRAM.COM") EndIf Sleep(500) ; let the computer do something WEnd Link to comment Share on other sites More sharing options...
vmlinux Posted June 16, 2011 Share Posted June 16, 2011 Please ignore the previous code, my first time messing with AutoIT so I got the syntax wrong. I should have tested it first . Also figured out how to get my code to block in purty colors . expandcollapse popup;set up vars Local $sasportexe, $sasportrun, $scriptdr,$procexist ;Get running folder, add trailing backslash $scriptdr = (@ScriptDir & '\') ;find the full file name as ver numbers may change $sasportexe = FileFindFirstFile($scriptdr & 'sas*.com') ;msgbox(0,"test1",$scriptdr & 'sas*.com') ;msgbox(0,"test2",$sasportexe) $sasportrun = FileFindNextFile($sasportexe) ;set the file name as file to run ;msgbox(0,"test3",$sasportrun) FileClose($sasportexe);close the search handle ;run the program Run($scriptdr & $sasportrun) ;msgbox(0,"test4",$scriptdr & $sasportrun) Sleep(4000) ; Wait for SAS to start ALL SLEEP FUNCTIONS NEEDED DO NOT REMOVE!!!!! ;inital welcome screen WinActivate("Portable Launcher", "Click here to start") WinWaitActive("Portable Launcher", "Click here to start") ControlClick("Portable Launcher","Click here to start",1) sleep(3000) If WinExists("SUPERAntiSpyware Language Selection", "OK") Then WinActivate("SUPERAntiSpyware Language Selection", "OK") WinWaitActive("SUPERAntiSpyware Language Selection", "OK") ControlClick("SUPERAntiSpyware Language Selection","OK",1) sleep(2500) EndIf $procexist =0 if ProcessExists("PROGRAM.COM") Then $procexist =1 ElseIf ProcessExists("PROGRAM64.COM") Then $procexist =1 EndIf ;sets up the loop while superantispyware is running - when the program closes it will end the loop While $procexist == 1 ;selects the language on selection screen ;from main menu this selects the scan button If WinExists("SUPERAntiSpyware Free Edition", "Scan your Computer") Then WinActivate("SUPERAntiSpyware Free Edition", "Scan your Computer") WinWaitActive("SUPERAntiSpyware Free Edition", "Scan your Computer") ControlClick("SUPERAntiSpyware Free Edition","Scan your Computer...",1090) sleep(1000) EndIf ;Selects a full scan option If WinExists("SUPERAntiSpyware", "scan") Then WinActivate("SUPERAntiSpyware", "scan") WinWaitActive("SUPERAntiSpyware", "scan") ControlClick("SUPERAntiSpyware","Perform Custom Scan",1073) ;Select full scan change to 1074 for custom scan and testing code below sleep(1000) EndIf ;can delete if wanted -was used for testing as selected custom scan (see comment just above). unchecks selected folders and runs custom with memory and cookies selection for speed #cs If WinExists("SUPERAntiSpyware", "scan") Then WinActivate("SUPERAntiSpyware", "scan") WinWaitActive("SUPERAntiSpyware", "scan") ControlClick("SUPERAntiSpyware","Selected Folders",1004) ;oring 1073 sleep(1000) EndIf If WinExists("SUPERAntiSpyware", "scan") Then WinActivate("SUPERAntiSpyware", "scan") WinWaitActive("SUPERAntiSpyware", "scan") ControlClick("SUPERAntiSpyware","Perform Custom Scan",1074) ;oring 1073 sleep(1000) EndIf #ce ;clicks next button once full scan is selected If WinExists("SUPERAntiSpyware", "Perform Complete Scan") Then WinActivate("SUPERAntiSpyware", "Perform Complete Scan") WinWaitActive("SUPERAntiSpyware", "Perform Complete Scan") ControlClick("SUPERAntiSpyware","&Next >",12324) sleep(1000) EndIf ;once scan is co,mpleted summary box opens and clicks to progress to removal screen If WinExists("SUPERAntiSpyware Scan Summary", "Potentially harmful items") Then WinActivate("SUPERAntiSpyware Scan Summary", "Potentially harmful items") WinWaitActive("SUPERAntiSpyware Scan Summary", "Potentially harmful items") ControlClick("SUPERAntiSpyware Scan Summary","Potentially harmful items",1) sleep(1000) EndIf ;nothing found and close If WinExists("SUPERAntiSpyware", "OK") Then WinActivate("SUPERAntiSpyware", "OK") WinWaitActive("SUPERAntiSpyware", "OK") ControlClick("SUPERAntiSpyware","OK",2) sleep(1000) ProcessClose("PROGRAM64.COM") sleep(1000) ProcessClose("PROGRAM.COM") sleep(1000) ProcessClose("PROGRAM64.COM") sleep(1000) ProcessClose("PROGRAM.COM") ;sometimes multiple instance found so double close added EndIf ;all spyware already checked by program so clicks ok to remove found spyware If WinExists("SUPERAntiSpyware", "Place a checkmark next to the items you wish to") Then WinActivate("SUPERAntiSpyware", "Place a checkmark next to the items you wish to") WinWaitActive("SUPERAntiSpyware", "Place a checkmark next to the items you wish to") ControlClick("SUPERAntiSpyware","&Next >",12324) sleep(1000) ;LogState("Spyware found and removed") ; writes in the log that spyware was found and removed $sasmal = 1 ; for cust report as above EndIf ;stops restart - restart will be required at some point If WinExists("SUPERAntiSpyware", "You must reboot to complete the remova") Then WinActivate("SUPERAntiSpyware", "You must reboot to complete the remova") WinWaitActive("SUPERAntiSpyware", "You must reboot to complete the remova") send("!N") sleep(1000) ;ControlClick("SUPERAntiSpyware","&Next >",12324) EndIf ;stops restart - restart will be required at some point and say ok i understand restart required If WinExists("SUPERAntiSpyware", "Your system is still infected, you must reboot") Then WinActivate("SUPERAntiSpyware", "Your system is still infected, you must reboot") WinWaitActive("SUPERAntiSpyware", "Your system is still infected, you must reboot") ControlClick("SUPERAntiSpyware","OK",2) sleep(1000) ProcessClose("superantispyware.exe") ProcessClose("PROGRAM64.COM") ProcessClose("PROGRAM.COM") EndIf ;clicks finish once spyware removed - If WinExists("SUPERAntiSpyware", "<B>Quarantined and Removed Items") Then WinActivate("SUPERAntiSpyware", "<B>Quarantined and Removed Items") WinWaitActive("SUPERAntiSpyware", "<B>Quarantined and Removed Items") MsgBox(1,"test","trying to close app") ControlClick("SUPERAntiSpyware","Close",12325) ProcessClose("superantispyware.exe") ProcessClose("PROGRAM64.COM") ProcessClose("PROGRAM.COM") EndIf Sleep(500) ; let the computer do something if ProcessExists("PROGRAM.COM") Then $procexist =1 ElseIf ProcessExists("PROGRAM64.COM") Then $procexist =1 Else $procexist =0 EndIf WEnd 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