blazyng Posted December 18, 2017 Share Posted December 18, 2017 Hello its me again, i want to start a Adware-remover (adw-cleaner) and do a scan with the command Command click. #RequireAdmin adw () Func adw () Run("C:\adwcleaner_7.0.5.0.exe","" ,@SW_MAXIMIZE ) ;Activate Window WinActivate ( "Malwarebytes AdwCleaner 7" , "" ) ; Wait 5 seconds for the window to appear. Local $hWnd = WinWait("CLASS:wxWindowNR", "", 5) ControlClick("Malwarebytes AdwCleaner 7","","CLASS:Button; TEXT:Scan; INSTANCE:4","","","","") EndFunc This is my code right now. ADW-Cleaner is starting, but it is not clicking anywhere, where is my mistake? (or mistakes as i believe :D) Link to comment Share on other sites More sharing options...
SlackerAl Posted December 18, 2017 Share Posted December 18, 2017 ControlClick("Malwarebytes AdwCleaner 7","","[CLASS:Button; TEXT:Scan; INSTANCE:4]") Any better? blazyng 1 Problem solving step 1: Write a simple, self-contained, running, replicator of your problem. Link to comment Share on other sites More sharing options...
blazyng Posted December 18, 2017 Author Share Posted December 18, 2017 16 minutes ago, SlackerAl said: ControlClick("Malwarebytes AdwCleaner 7","","[CLASS:Button; TEXT:Scan; INSTANCE:4]") Any better? Hi, no its still the same, startig ADW-Cleaner but no intention to click anywhere Thank u for ur answer! Link to comment Share on other sites More sharing options...
SlackerAl Posted December 18, 2017 Share Posted December 18, 2017 Sorry, this isn't really something I know much about, but I'll keep stabbing in the dark until someone more knowledgeable turns up... I see in your inspector window Text: Actions, but you have TEXT: Scan.... blazyng 1 Problem solving step 1: Write a simple, self-contained, running, replicator of your problem. Link to comment Share on other sites More sharing options...
aa2zz6 Posted December 18, 2017 Share Posted December 18, 2017 I dunno if this will help but here's an example I used to help someone last year with clicking a btn ^^ Posted December 21, 2016 (edited) · Report post Here you go buddy. Works on win7 Edit: The ID changes when the application is opened.. does someone know why the ID changes? #RequireAdmin ; must include when installing Example() Func Example() Local $hWnd = WinWait("[CLASS:TWizardForm]", "", 10) ; use AutoIt v3 Window Info tool ; located in the AutoIt folder. WinActivate($hWnd) ; WinActivate sets Setup - FreeOCR as an active screen ;Notes: ;ControlClick("title", "text", controlID[, button = "left"[, clicks = 1[, x[, y]]]]) ; title =>> $hWnd = WinWait("[CLASS:TWizardForm] ; "text" =>> "&Next >" ; controlID =>> 329210 ControlClick($hWnd, "&Next >", 329210) ; EndFunc ;==>Example Edited December 21, 2016 by aa2zz6 One last final thought :| blazyng 1 Link to comment Share on other sites More sharing options...
blazyng Posted December 18, 2017 Author Share Posted December 18, 2017 17 minutes ago, SlackerAl said: Sorry, this isn't really something I know much about, but I'll keep stabbing in the dark until someone more knowledgeable turns up... I see in your inspector window Text: Actions, but you have TEXT: Scan.... Sadly changing it into Actions or deleting it did not change anything.. Link to comment Share on other sites More sharing options...
blazyng Posted December 18, 2017 Author Share Posted December 18, 2017 10 minutes ago, aa2zz6 said: I dunno if this will help but here's an example I used to help someone last year with clicking a btn ^^ Posted December 21, 2016 (edited) · Report post Here you go buddy. Works on win7 Edit: The ID changes when the application is opened.. does someone know why the ID changes? #RequireAdmin ; must include when installing Example() Func Example() Local $hWnd = WinWait("[CLASS:TWizardForm]", "", 10) ; use AutoIt v3 Window Info tool ; located in the AutoIt folder. WinActivate($hWnd) ; WinActivate sets Setup - FreeOCR as an active screen ;Notes: ;ControlClick("title", "text", controlID[, button = "left"[, clicks = 1[, x[, y]]]]) ; title =>> $hWnd = WinWait("[CLASS:TWizardForm] ; "text" =>> "&Next >" ; controlID =>> 329210 ControlClick($hWnd, "&Next >", 329210) ; EndFunc ;==>Example Edited December 21, 2016 by aa2zz6 One last final thought :| Hi, thank you for your reply My problem is that i do not have any id to use like in your example Link to comment Share on other sites More sharing options...
SlackerAl Posted December 18, 2017 Share Posted December 18, 2017 I just tried this on the file open dialogue from Notepad++ to cancel the dialogue, and it worked test() Func test() ControlClick("Open","","[CLASS:Button; INSTANCE:2]") EndFunc So it seems if you have the window name correct, you just need the class and instance. Have you tried swapping your code around to read: #RequireAdmin adw () Func adw () Run("C:\adwcleaner_7.0.5.0.exe","" ,@SW_MAXIMIZE ) ; Wait 5 seconds for the window to appear. Local $hWnd = WinWait("CLASS:wxWindowNR", "", 5) ;Activate Window WinActivate ($hWnd) ControlClick($hWnd,"","CLASS:Button; TEXT:Scan; INSTANCE:4","","","","") EndFunc blazyng 1 Problem solving step 1: Write a simple, self-contained, running, replicator of your problem. Link to comment Share on other sites More sharing options...
blazyng Posted December 18, 2017 Author Share Posted December 18, 2017 7 minutes ago, SlackerAl said: I just tried this on the file open dialogue from Notepad++ to cancel the dialogue, and it worked test() Func test() ControlClick("Open","","[CLASS:Button; INSTANCE:2]") EndFunc So it seems if you have the window name correct, you just need the class and instance. Have you tried swapping your code around to read: #RequireAdmin adw () Func adw () Run("C:\adwcleaner_7.0.5.0.exe","" ,@SW_MAXIMIZE ) ; Wait 5 seconds for the window to appear. Local $hWnd = WinWait("CLASS:wxWindowNR", "", 5) ;Activate Window WinActivate ($hWnd) ControlClick($hWnd,"","CLASS:Button; TEXT:Scan; INSTANCE:4","","","","") EndFunc Hi, its a pity its not working either.. thank you four your effort Link to comment Share on other sites More sharing options...
SlackerAl Posted December 18, 2017 Share Posted December 18, 2017 Have you put in some error checking to confirm $hWnd is getting to set and is the window you think it is? e.g. msgbox yourself the title of that window from the handle. blazyng 1 Problem solving step 1: Write a simple, self-contained, running, replicator of your problem. Link to comment Share on other sites More sharing options...
aa2zz6 Posted December 18, 2017 Share Posted December 18, 2017 I'm wondering if the winactivate is activating that application. Can u place a folder on top of the application, run the script and see if it's pushing the folder behind it? Local $hWnd = WinWait("CLASS:wxWindowNR", "", 5) ;Activate Window WinActivate ($hWnd) blazyng 1 Link to comment Share on other sites More sharing options...
blazyng Posted December 18, 2017 Author Share Posted December 18, 2017 7 minutes ago, aa2zz6 said: I'm wondering if the winactivate is activating that application. Can u place a folder on top of the application, run the script and see if it's pushing the folder behind it? Local $hWnd = WinWait("CLASS:wxWindowNR", "", 5) ;Activate Window WinActivate ($hWnd) Hi, its not pushing the folder behind. Does that mean WinActivate is not working? Link to comment Share on other sites More sharing options...
blazyng Posted December 18, 2017 Author Share Posted December 18, 2017 11 minutes ago, SlackerAl said: Have you put in some error checking to confirm $hWnd is getting to set and is the window you think it is? e.g. msgbox yourself the title of that window from the handle. I did not work with msgbox before, how can i link it to the handle? MsgBox ( 0, "error", "?" , timeout = 0 , CLASS:wxWindowNR ) should it be like that? Link to comment Share on other sites More sharing options...
aa2zz6 Posted December 18, 2017 Share Posted December 18, 2017 Bingo! I would possibly look at troubleshooting with the winactivate function and once it works I would imagine the control click should be a walk in the park . 1) Winactivate - Set the Application Window above the folder. ActiveWindow() Func ActiveWindow() $hWnd1 = WinGetHandle("[CLASS: PUT CLASS ID HERE ]") If IsHWnd($hWnd1) Then WinActivate($hWnd1) EndIf EndFunc ;==>ActiveWindow 2) Once the application is activated and it's above every window a controlclick to press the btn should work. ControlClick Sends a mouse click command to a given control. ControlClick ( "title", "text", controlID [, button = "left" [, clicks = 1 [, x [, y]]]] ) Parameters title The title/hWnd/class of the window to access. See Title special definition. text The text of the window to access. See Text special definition. controlID The control to interact with. See Controls. button [optional] The button to click, "left", "right", "middle", "main", "menu", "primary", "secondary". Default is the left button. clicks [optional] The number of times to click the mouse. Default is 1. x [optional] The x position to click within the control. Default is center. y [optional] The y position to click within the control. Default is center. Link to comment Share on other sites More sharing options...
SlackerAl Posted December 18, 2017 Share Posted December 18, 2017 (edited) Here is some test code for Notepad++, change some names and get yours working test() Func test() Local $hWnd = WinWaitActive("[CLASS:Notepad++]", "") MsgBox(0, "", WinGetTitle($hWnd)) EndFunc Edited December 18, 2017 by SlackerAl Problem solving step 1: Write a simple, self-contained, running, replicator of your problem. Link to comment Share on other sites More sharing options...
blazyng Posted December 18, 2017 Author Share Posted December 18, 2017 3 minutes ago, SlackerAl said: Here is some test code for Notepad++, change some names and get yours working test() Func test() Local $hWnd = WinWaitActive("[CLASS:Notepad++]", "") MsgBox(0, "", WinGetTitle($hWnd)) EndFunc Hi, thank you This is what im getting back It seems like im getting the right windows/handle or am i wrong? Link to comment Share on other sites More sharing options...
SlackerAl Posted December 18, 2017 Share Posted December 18, 2017 I can only suggest you build that into your script, sending msgbox's to yourself as you go, using the same handle for your control sends, so you know the target is there and correct.... and active. Sorry out of ideas after that. Problem solving step 1: Write a simple, self-contained, running, replicator of your problem. Link to comment Share on other sites More sharing options...
Earthshine Posted December 18, 2017 Share Posted December 18, 2017 (edited) how about use the command line instead https://toolslib.net/forum/viewthread/2611-command-line-adwcleaner/ malwarebytes really cheeses me off now. it used to be good, now it sucks all the life out of even the fastest computers... sigh Edited December 18, 2017 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
blazyng Posted December 19, 2017 Author Share Posted December 19, 2017 15 hours ago, Earthshine said: how about use the command line instead https://toolslib.net/forum/viewthread/2611-command-line-adwcleaner/ malwarebytes really cheeses me off now. it used to be good, now it sucks all the life out of even the fastest computers... sigh Hi, there is no more command line for the newest adwcleaner version :S Thank you all for your ideas! Link to comment Share on other sites More sharing options...
junkew Posted December 28, 2017 Share Posted December 28, 2017 Whats the output of au3inf or other spying tools of faq31. Maybe app is written with java and then it will be a little more complex. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets 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