fheaky Posted September 29, 2014 Share Posted September 29, 2014 (edited) Hello, I have been using autoit for a while now to create the scripts I need to automate some basic things. However, I have a problem and I hope someone more knowledgeable can help me out. I am trying to use the MouseclickPlus function to do a long click in a minimized window, but I can't figure out how to do this. expandcollapse popup;=============================================================================== ; ; 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) 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 This is the MouseClickPlus function, but could anyone give me some pointers on what I need to do with it to make it hold the mouse button down for a bit and then release it, instead of just making it click? Best regards, Fheaky. Edited September 29, 2014 by fheaky Link to comment Share on other sites More sharing options...
fheaky Posted September 30, 2014 Author Share Posted September 30, 2014 Anyone? Link to comment Share on other sites More sharing options...
Belini Posted September 30, 2014 Share Posted September 30, 2014 (edited) MouseDown() and MouseUp() not can working for you? MouseDown("Left"); press the down button sleep(2000); holding the button down for 2 seconds MouseUp("Left"); Releases the button Edited September 30, 2014 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
fheaky Posted September 30, 2014 Author Share Posted September 30, 2014 MouseDown() and MouseUp() not can working for you? MouseDown("Left"); press the down button sleep(2000); holding the button down for 2 seconds MouseUp("Left"); Releases the button That works, yeah and that is what I was using but the problem with that is that I can't use the computer when I use that instead of Mouseclickplus, that's why I was wondering whether I could do the same with MouseClickplus so that I can keep using the computer while the script runs in the background. Link to comment Share on other sites More sharing options...
Bert Posted October 1, 2014 Share Posted October 1, 2014 What are you automating that requires you to hold the mouse button down for a period of time in a window that does not have focus? I've never heard of an application that needed that. Just looking to learn here. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
jdelaney Posted October 1, 2014 Share Posted October 1, 2014 https://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F Locked, minimized, behind desktop, this one covers it all ^ IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. 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