Insolence Posted December 30, 2004 Posted December 30, 2004 (edited) 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 I think Larry made the _MakeLong function, so credit goes to him on that. I got a lot of help on the entire thing, I just threw it into a function. I'll have to figure out how to get the actual area size of the window excluding the title bar for some games, atleast in Diablo II. EDIT: To get D2 offsets use this code: $winsize = WinGetPos("Diablo II") $borderwidth = ($winsize[2] - 800) / 2 $titleheight = $winsize[3] - 600 - (2 * $borderwidth) msgbox("", "", $borderwidth & " " & $titleheight) And use it like so: _MouseClickPlus( "Diablo II", "left", 525 - $borderwidth, 585 - $TitleHeight ) Edited July 20, 2009 by Jon ibrahem 1 "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.
Crome_BAD Posted December 30, 2004 Posted December 30, 2004 I kno this is a pointless post, but ive been trying to do that forever. THANK YOU ALOT!!!! lol. Im still very new to AutoIt. Peace, Crome_BAD
Insolence Posted December 30, 2004 Author Posted December 30, 2004 Pointless by NO means! I do this to help people, my personal benefit is minimal seeing as how I don't play the game. "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.
Crome_BAD Posted December 30, 2004 Posted December 30, 2004 ive been playing since it came out. I thank you for this wonderful function. Now to figure out how to use it:P Very new at this...lol. Crome_BAD
Insolence Posted December 30, 2004 Author Posted December 30, 2004 I posted an example at the bottom of my script, just include that function inside your script and call it. All you gotta do "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.
pcdestroyer Posted December 30, 2004 Posted December 30, 2004 very nice @insolence very nice !!!!!!!!! can u also use pixelgetcolor in a minimized window ?
Crome_BAD Posted December 30, 2004 Posted December 30, 2004 Well, i tried ur function with a test.au3 file, i couldnt get it to delete it. Any suggestions?
Insolence Posted December 30, 2004 Author Posted December 30, 2004 (edited) very nice @insolence very nice !!!!!!!!! can u also use pixelgetcolor in a minimized window ? <{POST_SNAPBACK}>Nope, sadly you cannot.[EDIT] Delete what??? Edited December 30, 2004 by Insolence "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.
Crome_BAD Posted December 30, 2004 Posted December 30, 2004 A file, i dont have diablo installed on this cp or i would test on it, all i have is a file saved in a folder, and the folder iz minimized, trying to delete it from there Ive also tried MSWord i couldnt get it to click on the close button
pcdestroyer Posted December 30, 2004 Posted December 30, 2004 (edited) wtf ? it wont click in the d2 window at alll dunno why ... do i have to use borderwidht and title height ? Edit: Insolence reply plz it wont click man .. or if it clicks it clicks like 5 extra pixels in X axis and about 30 extra pixels in Y axis Edited December 30, 2004 by pcdestroyer
Insolence Posted December 30, 2004 Author Posted December 30, 2004 You have to use the offsets thing I supplied at the bottom. "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.
pcdestroyer Posted December 31, 2004 Posted December 31, 2004 (edited) hmm .. i use the offset but it makes it even worse ..... it just doesnt work for me Edit: nevermind i got it !!!!!!!!! now it is 100% accurate with my editing in the script give me some tiem ... ill post an explanation Edited December 31, 2004 by pcdestroyer
Insolence Posted December 31, 2004 Author Posted December 31, 2004 Alright "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.
pcdestroyer Posted December 31, 2004 Posted December 31, 2004 (edited) ok look @ the picture enjoy Edited December 28, 2012 by Jon
Insolence Posted December 31, 2004 Author Posted December 31, 2004 Yeah I knew that was the problem -.- I mentioned it in the first post. $winsize = WinGetPos("Diablo II") $borderwidth = ($winsize[2] - 800) / 2 $titleheight = $winsize[3] - 600 - (2 * $borderwidth) msgbox("", "", $borderwidth & " " & $titleheight) But you need to automize that, does the above code not find those values? If not maybe this will work: $winsize = WinGetPos("Diablo II") $borderwidth = $winsize[2] - 800 $titleheight = $winsize[3] - 600 msgbox("", "", $borderwidth & " " & $titleheight) ibrahem 1 "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.
pcdestroyer Posted December 31, 2004 Posted December 31, 2004 (edited) oooooooo thnx ) Edit: hmm i tried it with $borderwidht and $titleheight ... but it clicks on a completely different place ... dont know why ;( Edited December 31, 2004 by pcdestroyer ibrahem 1
Crome_BAD Posted December 31, 2004 Posted December 31, 2004 Again Insolence, i thank you alot for this function. And to you PcDestroyer for clarifing it. Bots will be much easier Peace, Crome_BAD
pcdestroyer Posted December 31, 2004 Posted December 31, 2004 (edited) hmm... it seems that , when i use $borderwidth and $titleheight it clicks on a completely different place BUT if i use their real values which are "3" and "26" it works .... if i use them as a variable it wont work ... is this a bug or something ?! Edited December 31, 2004 by pcdestroyer
Insolence Posted December 31, 2004 Author Posted December 31, 2004 No it's gotta be something in your script, why don't you post it in support. "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.
Recommended Posts