vbfg Posted February 2, 2013 Share Posted February 2, 2013 (edited) Hello, I'm having trouble finding a method that will send a mouse down and mouse up events to a window by handle or by title, in a manner like ControlClick does. I think there is no such default method in AutoIt, but maybe it's just called something unusual and can't be easily found.Anyway, how do I send a mouse down and mouse up events to a minimized window at specific coordinates like ControlClick does?(because I can't just do MouseDown() and MouseUp() since target window is minimized, and should never steal focus from any windows on its own) Edited February 2, 2013 by vbfg Link to comment Share on other sites More sharing options...
somdcomputerguy Posted February 2, 2013 Share Posted February 2, 2013 Get the ID of the control you want to ControlClick, use this - AutoIt Window Info Tool (AU3Info) to get it. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
vbfg Posted February 2, 2013 Author Share Posted February 2, 2013 Sorry, I should've made it more clear. I can't achieve what I want by using ControlClick (since it doesn't support Down and Up modes, just clicking), but I also can't use MouseDown or MouseUp, because the target window must stay minimized, or at least not active. Link to comment Share on other sites More sharing options...
Bowmore Posted February 2, 2013 Share Posted February 2, 2013 You could try sending windows messages directly #include <SendMessage.au3> #include <WindowsConstants.au3> _SendMessage($hWndControl, $WM_LBUTTONDOWN) _SendMessage($hWndControl, $WM_LBUTTONUP) YouDontKnowMe 1 "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
vbfg Posted February 2, 2013 Author Share Posted February 2, 2013 But I also need them to be at specified coordinates, is it possible to send such message? Maybe send a mouse move message prior to up/down? Link to comment Share on other sites More sharing options...
Bowmore Posted February 2, 2013 Share Posted February 2, 2013 Yes you can include coordinates and other information, such keys Ctrl Shift etc. held down.If you want to learn the details check out this link. http://msdn.microsoft.com/en-us/library/ms645607(v=vs.85).aspx#include <SendMessage.au3> #include <WindowsConstants.au3> Local $hWndControl = 0 ; Set to handel of the control Local $x = 50 ; X coord for Mouse click Local $y = 20 ; Y coord for Mouse click Local $wParam = 0 Local $lParam = BitRotate($x,16,"D") $lParam = BitXOR($lParam,$y) _SendMessage($hWndControl, $WM_LBUTTONDOWN,$wParam,$lParam) _SendMessage($hWndControl, $WM_LBUTTONUP,$wParam,$lParam) YouDontKnowMe 1 "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
vbfg Posted February 2, 2013 Author Share Posted February 2, 2013 Great, this works! Thanks everyone! Link to comment Share on other sites More sharing options...
Miliardsto Posted June 28, 2019 Share Posted June 28, 2019 how to use this? from hold left button from x y and up on x y+300 expandcollapse popup#include <ImageSearch.au3> #include <SendMessage.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> Opt("MouseCoordMode", 1) global $y, $x, $x2, $y2 $sText = "Swintusz" $handle = WinGetHandle($sText) Sleep(200) dragAr() Func dragAr() Local $search = _ImageSearch('ar.bmp', 0, $x, $y, 32) If $search = 1 Then Local $hWndControl = $handle ; Set to handel of the control Local $wParam = 0 Local $lParam = BitRotate($x,16,"D") $lParam = BitXOR($lParam,$y) _SendMessage($hWndControl, $WM_LBUTTONDOWN,$wParam,$lParam) Sleep(1000) $y=$y+330 Local $wParam = 0 Local $lParam = BitRotate($x,16,"D") $lParam = BitXOR($lParam,$y) _SendMessage($hWndControl, $WM_LBUTTONDOWN,$wParam,$lParam) EndIf EndFunc 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