Jump to content

ControlClick Right Click Not Working

Recommended Posts


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:

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.

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 comment
Share on other sites


Func Example()
        ; Run Notepad

        ; 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.")


        ControlClick($hWnd, "", "Edit1","secondary",1)

        Send("{DOWN 4}")


        ; Alternatively try Send("{APPSKEY}")


        Send("{DOWN 4}")

EndFunc   ;==>Example


I know that I know nothing

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

  • Recently Browsing   0 members

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