kornholeking 1 Posted June 21 Share Posted June 21 Hello, I hope this is a severe oversight on my part as I feel that I understand how to use the ControlClick function fairly decently, but for some reason when I am attempting to use the following lines the second ControlClick command below does not open the context menu within the application that I am attempting to right click within: WinActivate("Default") WinWaitActive("Default") ControlClick("Default", "", 1005, "primary", 1, 150, 10) ControlClick("Default", "", 1005, "secondary", 1, 150, 10) I am able to manually right click on the location in question within the application to bring up the context menu. I threw in the first ControlClick above to ensure that the function is finding the correct control ID and location by single (left) clicking which highlights an object within the application, so I can confirm that that first ControlClick is working. For grins, I opened up a blank Notepad to test the same lines above and was able to pull up the context menu. I also tried swapping my mouse buttons to see if that would make any impact and then I was able to primary (right) click but still unable to secondary (left) click to bring up the context menu within my application. As a workaround, I am using the MouseClick function which seems to work fine. However, I've noticed that the window of the application in question tends to move around upon launch (sometimes even offscreen) and the MouseClick function has gotten caught up when reaching the edge of the screen. WinActivate("Default") WinWaitActive("Default") Opt("MouseCoordMode", 2) MouseClick($MOUSE_CLICK_SECONDARY, 150, 45) All signs point to my application being the culprit here for some reason, but I was wondering if anyone else has come across this sort of a scenario or what other options might be available as I'd prefer to use the ControlClick function since MouseClick seems to run into the challenges I mentioned above. Link to post Share on other sites
ioa747 2 Posted Tuesday at 06:07 PM Share Posted Tuesday at 06:07 PM try to give some sleep time between Sleep(50) Link to post Share on other sites
ioa747 2 Posted Tuesday at 06:16 PM Share Posted Tuesday at 06:16 PM Alternatively try Send("{APPSKEY}") Link to post Share on other sites
kornholeking 1 Posted Tuesday at 08:50 PM Author Share Posted Tuesday at 08:50 PM @ioa747Neither seem to have any impact. I can see the initial "primary" click, the pause from sleep, and then nothing. When I try without the first ControlClick (still keeping the pause), it just seems to not to anything after the window is activated. 🤷♀️ Link to post Share on other sites
ioa747 2 Posted Tuesday at 09:16 PM Share Posted Tuesday at 09:16 PM Example() Func Example() ; Run Notepad Run("notepad.exe") ; Wait 10 seconds for the Notepad window to appear. Local $hWnd = WinWait("[CLASS:Notepad]", "", 10) ; Send a mouse click to the edit control of Notepad using the handle returned by WinWait. ControlClick($hWnd, "", "Edit1") ; Add new data to the clipboard. ClipPut("A new string added to the clipboard.") Sleep(50) ControlClick($hWnd, "", "Edit1","secondary",1) Send("{DOWN 4}") Send("{ENTER}") Sleep(50) Send("{ENTER}") ; Alternatively try Send("{APPSKEY}") Sleep(3000) Send("{APPSKEY}") Send("{DOWN 4}") Send("{ENTER}") EndFunc ;==>Example Link to post Share on other sites
kornholeking 1 Posted Tuesday at 10:09 PM Author Share Posted Tuesday at 10:09 PM @ioa747Just wanted to reiterate that I have tested the ControlClick "secondary" command and confirmed that it works in a notepad. Send("{APPSKEY}") also works in notepad. Neither option works in this particular app/window that I am currently working with, though. Link to post Share on other sites
ioa747 2 Posted Tuesday at 10:22 PM Share Posted Tuesday at 10:22 PM which application is that? Link to post Share on other sites
kornholeking 1 Posted Tuesday at 10:26 PM Author Share Posted Tuesday at 10:26 PM The application is called AWD. Link to post Share on other sites
ioa747 2 Posted Tuesday at 10:50 PM Share Posted Tuesday at 10:50 PM it's that run in android Virtual Environment? Link to post Share on other sites
kornholeking 1 Posted Thursday at 03:02 PM Author Share Posted Thursday at 03:02 PM No, it's a Windows application. Specifically, it's running on Windows 10. Link to post Share on other sites
ad777 23 Posted Friday at 04:53 PM Share Posted Friday at 04:53 PM @kornho.. Maybe the app resist clicking unless they are the active window. Use the WinActivate() function to force the control's window to the top before using ControlClick(). iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to post Share on other sites
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