Philster Posted January 13, 2005 Share Posted January 13, 2005 Hi, I was wondering how I send a mouseclick to a window (that doesn't have focus), but without moving the mouse. (Scenario could be a internet Explorer window). I want the mouse to click at a specific set of coordinates. As far as I can, the ControlClick doesn't allow me to specify where on the control to click. On the other hand, I can't send MouseClicks to a window in the background? I suppose one solution could be store the "current" mouse-position, move the mouse, click, and move the mouse back? (and how do I deal with the focus?) Link to comment Share on other sites More sharing options...
DirtyBanditos Posted January 13, 2005 Share Posted January 13, 2005 (edited) Hi,I was wondering how I send a mouseclick to a window (that doesn't have focus), but without moving the mouse. (Scenario could be a internet Explorer window).I want the mouse to click at a specific set of coordinates.As far as I can, the ControlClick doesn't allow me to specify where on the control to click. On the other hand, I can't send MouseClicks to a window in the background?I suppose one solution could be store the "current" mouse-position, move the mouse, click, and move the mouse back? (and how do I deal with the focus?)<{POST_SNAPBACK}>Hello looks on the Help files on your Autoit3 Order! Or use The forum Search.You have troubel wis your code, then post it and any looks for it) Edited January 13, 2005 by DirtyBanditos Link to comment Share on other sites More sharing options...
Nova Posted January 13, 2005 Share Posted January 13, 2005 (edited) was wondering how I send a mouseclick to a window (that doesn't have focus)Wouldnt that make the window active ?So why not winactive and then mouseclick ? Edited January 13, 2005 by Nova Link to comment Share on other sites More sharing options...
Philster Posted January 14, 2005 Author Share Posted January 14, 2005 Wouldnt that make the window active ?So why not winactive and then mouseclick ?<{POST_SNAPBACK}>Actually I have a "robot" for a game I play, that sends the mouseclick to my game and that doesn't make the window active, and was hoping I could do the same with AutoIt PS sorry about the late reply, I didn't receive e-mail notifications Link to comment Share on other sites More sharing options...
Philster Posted January 14, 2005 Author Share Posted January 14, 2005 (edited) Hello looks on the Help files on your Autoit3 Order! Or use The forum Search.You have troubel wis your code, then post it and any looks for it) <{POST_SNAPBACK}>Hehe, I don't have any code yet, but I'm searching for the function that will allow me to send a mouseclick to a unfocused window I've looked at the online documentation and in the examples, but I couldn't seem to find what I'm looking for Edited January 14, 2005 by Philster Link to comment Share on other sites More sharing options...
Fur Posted January 14, 2005 Share Posted January 14, 2005 I'm thinking your only hope is DllCall() to SendMessage and fire off a WM_MOUSEDOWN and WM_MOUSEUP. Link to comment Share on other sites More sharing options...
Philster Posted January 17, 2005 Author Share Posted January 17, 2005 I'm thinking your only hope is DllCall() to SendMessage and fire off a WM_MOUSEDOWN and WM_MOUSEUP.<{POST_SNAPBACK}>Ahhh ok, I'll try that (though I'm not very well versed in windows-Messages :"> ) Link to comment Share on other sites More sharing options...
Insolence Posted January 17, 2005 Share Posted January 17, 2005 Scripts and Scraps forum, I made a UDF for it "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Philster Posted January 17, 2005 Author Share Posted January 17, 2005 Scripts and Scraps forum, I made a UDF for it <{POST_SNAPBACK}>http://www.autoitscript.com/forum/index.ph...12&hl=InsolenceI'll have a look, it seems exactly what I'm looking for Link to comment Share on other sites More sharing options...
Philster Posted January 17, 2005 Author Share Posted January 17, 2005 (edited) http://www.autoitscript.com/forum/index.ph...12&hl=InsolenceI'll have a look, it seems exactly what I'm looking for<{POST_SNAPBACK}>Im trying to make it click in Internet Explorer, but I can't seem to make it work.http://philip.act-consult.com/game.htmlexpandcollapse popupWinActivate ("http://philip.act-consult.com/game.html - Microsoft Internet Explorer", "") WinWaitActive("http://philip.act-consult.com/game.html - Microsoft Internet Explorer") MouseMove(531, 324, 3);just to see the coordinate is the blue button _MouseClickPlus("http://philip.act-consult.com/game.html - Microsoft Internet Explorer", "left", 531, 324, 1) ;=============================================================================== ; ; Function Name: _MouseClickPlus() ; Version added: 0.1 ; Description: Sends a click to window, not entirely accurate, but works ; minimized. ; Parameter(s): $Window = Title of the window to send click to ; $Button = "left" or "right" mouse button ; $X = X coordinate ; $Y = Y coordinate ; $Clicks = Number of clicks to send ; Remarks: You MUST be in "MouseCoordMode" 0 to use this without bugs. ; Author(s): Insolence <insolence_9@yahoo.com> ; ;=============================================================================== Func _MouseClickPlus($Window, $Button = "left", $X = "", $Y = "", $Clicks = 1) ;Func _MouseClickPlus($Window, $Button, $X, $Y, $Clicks) Local $MK_LBUTTON = 0x0001 Local $WM_LBUTTONDOWN = 0x0201 Local $WM_LBUTTONUP = 0x0202 Local $MK_RBUTTON = 0x0002 Local $WM_RBUTTONDOWN = 0x0204 Local $WM_RBUTTONUP = 0x0205 Local $WM_MOUSEMOVE = 0x0200 Local $i = 0 Select Case $Button = "left" $Button = $MK_LBUTTON $ButtonDown = $WM_LBUTTONDOWN $ButtonUp = $WM_LBUTTONUP Case $Button = "right" $Button = $MK_RBUTTON $ButtonDown = $WM_RBUTTONDOWN $ButtonUp = $WM_RBUTTONUP EndSelect If $X = "" OR $Y = "" Then $MouseCoord = MouseGetPos() $X = $MouseCoord[0] $Y = $MouseCoord[1] EndIf For $i = 1 to $Clicks DllCall("user32.dll", "int", "SendMessage", _ "hwnd", WinGetHandle( $Window ), _ "int", $WM_MOUSEMOVE, _ "int", 0, _ "long", _MakeLong($X, $Y)) DllCall("user32.dll", "int", "SendMessage", _ "hwnd", WinGetHandle( $Window ), _ "int", $ButtonDown, _ "int", $Button, _ "long", _MakeLong($X, $Y)) DllCall("user32.dll", "int", "SendMessage", _ "hwnd", WinGetHandle( $Window ), _ "int", $ButtonUp, _ "int", $Button, _ "long", _MakeLong($X, $Y)) Next EndFunc Func _MakeLong($LoWord,$HiWord) Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF)) EndFunc Edited January 17, 2005 by Philster 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