Jump to content

Simple automation, help


Recommended Posts

Trying to get a program automated.  Had it at one point but not sure what happened.  It gets stuck on a pop up from main program and won't continue. It gets activated but won't push the button.  Program is portable don't need to install it even. 

Adware_Removal_Tool_by_TSA

 

#RequireAdmin

;Give you admin rights
; By doing this you can have folder anywhere just as long as exe is in same folder as script.

; 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)
;~ ;Sleep(12000)
WinWait("Adware Removal Tool by TSA")
WinActivate("Adware Removal Tool by TSA")
Sleep(300)
MouseClick('primary', 511, 543, 1, 0)
Sleep(1200)
MouseClick('primary', 84, 361, 1, 0)

WinWait("Adware_Removal_Tool_by_TSA")
WinActivate("Adware_Removal_Tool_by_TSA")
MouseClick('primary', 430, 132, 1, 0)
WinWait( "Adware")
Sleep(900)
WinActivate( "Adware")
Sleep(900)
MouseClick('primary', 512, 543, 1, 0)

WinWait( "Adware" , "closed ones" )
Sleep(900)
WinActivate( "Adware" , "closed ones" )
Sleep(900)
MouseClick('primary', 430, 133, 1, 0)
Sleep(900)
WinWait( "Adware_Removal_Tool_by_TSA" , "OK" )
Sleep(900)
WinActivate( "Adware_Removal_Tool_by_TSA" , "OK" )
Sleep(900)
Send("{enter}")
Sleep(900)
Send("{enter}")
Sleep(900)
 ;ControlClick ( "Adware_Removal_Tool_by_TSA", "OK", Button1 [, button = "left" [, clicks = 1 [, 321 [, 118]]]] )
;this next line is my second attemp to get it to push button.
ControlSend("Adware_Removal_Tool_by_TSA", "", "[CLASSNN:Button1]", "OK")

 MouseClick('primary', 321, 119, 1, 0)

Sleep(900)
WinWait("Adware Removal Tool by TSA")
WinActivate("Adware Removal Tool by TSA")
Sleep(300)
MouseClick('primary', 511, 543, 1, 0)
Sleep(300)
MouseClick('primary', 80, 44, 1, 0)
Send("{TAB}")
Sleep(900)
Send("{TAB}")
Sleep(900)
Send("{TAB}")
Sleep(900)
Send("{enter}")
Sleep(300)
MouseClick('primary', 510, 538, 1, 0)
Sleep(300)
MouseClick('primary', 510, 538, 1, 0)

Thanks for any guidence.

Link to comment
Share on other sites

Try switching the MouseClick (unreliable) to ControlClick, with a ControlFocus before hand.  Use the AutoIT spy tool to get the controls identifiers.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Looks like your incorrectly using a ControlSend() in the code, that is for sending characters to a control (like text in an input field), you want to use ControlClick instead.

If you cant find ControlClick() to work in this case, the next best thing IMO is to use keyboard sends instead of mouse clicks.  Almost any installer lets you use tab, enter, arrow keys, and even combo keys like alt+n or alt+e to work the gui.  

Also get with the people that make the program, they could possibly have command line parameters for it so you can run it programmatically without the GUI.

 

Seems this is not as easy as it looks, the program is pretty poorly coded.  The window instance never changes, and all of the text is present in the whole time so there is no real way to do a proper WinWait() to avoid all of those Sleep() periods.

The only saving grace is the couple of pop ups that are a different so you can use those as wait markers, so like this it worked for me on my VM but you may need to add sleep for a computer that actually has infections or runs slower.

#RequireAdmin
ShellExecute("Adware_Removal_Tool_by_TSA.exe")
WinWait("[TITLE:Adware Removal Tool by TSA; INSTANCE:1]", "")
WinActivate("Adware Removal Tool by TSA", "")
ControlClick("Adware Removal Tool by TSA", "", "[NAME:Button_IAgree]")
WinWait("[TITLE:Adware Removal Tool by TSA; INSTANCE:1]", "")
WinActivate("Adware Removal Tool by TSA", "")
ControlClick("Adware Removal Tool by TSA", "", "[NAME:Button_Scan]")
WinWait("Adware_Removal_Tool_by_TSA", "The scan has been successfully finished. Click on 'OK' to get results")
WinActivate("Adware_Removal_Tool_by_TSA", "The scan has been successfully finished. Click on 'OK' to get results")
ControlClick("Adware_Removal_Tool_by_TSA", "The scan has been successfully finished. Click on 'OK' to get results", 2)
WinWait("[TITLE:Adware Removal Tool by TSA; INSTANCE:1]", "")
WinActivate("Adware Removal Tool by TSA", "")
ControlClick("Adware Removal Tool by TSA", "", "[NAME:Button_Clean]")
WinWait("Adware_Removal_Tool_by_TSA", "The cleaning process has finished. Click on 'OK' to get result.")
WinActivate("Adware_Removal_Tool_by_TSA", "The cleaning process has finished. Click on 'OK' to get result.")
ControlClick("Adware_Removal_Tool_by_TSA", "The cleaning process has finished. Click on 'OK' to get result.", 2)
WinWait("[TITLE:Adware Removal Tool by TSA; INSTANCE:1]", "")
WinActivate("Adware Removal Tool by TSA", "")
ControlClick("Adware Removal Tool by TSA", "", "[NAME:Button_Next_on_cleaning]")
WinWait("[TITLE:Adware Removal Tool by TSA; INSTANCE:1]", "")
WinActivate("Adware Removal Tool by TSA", "")
ControlClick("Adware Removal Tool by TSA", "", "[NAME:Button_Next_onBrowser_Reset]")
WinWait("[TITLE:Adware Removal Tool by TSA; INSTANCE:1]", "")
WinActivate("Adware Removal Tool by TSA", "")
ControlClick("Adware Removal Tool by TSA", "", "[NAME:Button_Finish]")

P.S. My script does not match up to yours 100% not sure if that is because you ran a few different options, or had infections, or different version but I hope this is enough to get you in the right direction if you need to change it.  I was running the newest version from the site. 

Edited by ViciousXUSMC
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...