Jump to content

ControlClick instead MouseClick


Recommended Posts

Hello I got this script works below and I want to do not move cursor on screen when action is performed.

Opt("MouseCoordMode", 1) ; cause it gets whole screen coords
     Local $x, $y
     Local $search = _ImageSearch('item.bmp', 0, $x, $y, 0)
          If $search = 1 Then
             MouseMove($x, $y,0)
             MouseClick("right", $x, $y))
             MouseMove($xMiddle, $yMiddle,0)
             MouseClick("left", $xMiddle, $yMiddle)
          EndIf

I changed this above to this below and what happen is. It clicks right button and then left button but not move mouse to $x $y and then to $xMiddle $yMiddle.

Opt("MouseCoordMode", 1) ; cause it gets whole screen coords
     Local $x, $y
     Local $search = _ImageSearch('item.bmp', 0, $x, $y, 0)
          If $search = 1 Then
             ControlClick("","",0,"secondary",1,$x,$y)
             ControlClick("","",0,"primary",1,$xMiddle,$yMiddle)
          EndIf

If needed I got handle in var $hwnd

Please tell me how parameters in ControlClick would like be

Link to comment
Share on other sites

  • Moderators

@Miliardsto the whole point of ControlClick is to interact with the button without the need for the less-reliable MouseMove/MouseClick combo. It sounds as though it is working as you have it written, it clicks the buttons. If you need to move the mouse specifically to a position, you would still need to use the MouseMove line. But I would ask first why you need the mouse to be at that exact position.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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

×
×
  • Create New...