Scorpius Posted July 8, 2005 Posted July 8, 2005 I've tried to use the function from http://www.autoitscript.com/forum/index.php?showtopic=7112 to try to do some minimized clicking from what I can tell it does nothing in game (Star Wars Galaxies), but if I do control my mouse and hover over something it like flashes the hover color instead of staying solid which makes me think it does move or something.This is the code I use now:expandcollapse popupOpt("MouseClickDelay", 1) Opt("MouseCoordMode", 0) Func _MouseClickPlus($Window, $Button = "left", $X = "", $Y = "", $Clicks = 2) 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 $j = 0 While $j <= 10 If WinExists("Windows Task Manager") Then Exit EndIf _MouseClickPlus( "SwgClient", "left" ) _MouseClickPlus( "SwgClient", "left", 430, 260 ) _MouseClickPlus( "SwgClient", "left", 490, 260 ) _MouseClickPlus( "SwgClient", "left", 360, 325 ) _MouseClickPlus( "SwgClient", "left", 425, 325 ) WEnd
Moderators SmOke_N Posted July 8, 2005 Moderators Posted July 8, 2005 (edited) How are you calling the funciton? I mean, this is exactly what you posted earlier, but your not showing any of YOUR code for anyone to help you w/. Edit: Typo Edited July 8, 2005 by ronsrules Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Scorpius Posted July 8, 2005 Author Posted July 8, 2005 Well, If you look at the bottom of the script it's right there. It's a very simple script, just clicking 5 things for me, and thats all $j = 0 While $j <= 10 If WinExists("Windows Task Manager") Then Exit EndIf _MouseClickPlus( "SwgClient", "left" ) _MouseClickPlus( "SwgClient", "left", 430, 260 ) _MouseClickPlus( "SwgClient", "left", 490, 260 ) _MouseClickPlus( "SwgClient", "left", 360, 325 ) _MouseClickPlus( "SwgClient", "left", 425, 325 ) WEnd
Moderators SmOke_N Posted July 8, 2005 Moderators Posted July 8, 2005 (edited) Sorry about that, not used to looking at the bottom of a script for the While Loop. See if this helps, I haven't tested it. expandcollapse popupGlobal $winsize = WinGetPos("SwgClient"); Assuming SwgClient is the name of the Window you want to cick in Global $borderwidth = $winsize[2] - 800 Global $titleheight = $winsize[3] - 600 Play() Func Play() Opt("MouseClickDelay", 1) Opt( "MouseCoordMode", 0) While 1; $j = 0 : While $j <= 10 (this will always be less than 10 if that is all your code) If WinExists("Windows Task Manager") Then Exit EndIf _MouseClickPlus( "SwgClient", "left", 430 - $borderwidth, 260 - $titleheight, 1 ) _MouseClickPlus( "SwgClient", "left", 490 - $borderwidth, 260 - $titleheight, 1 ) _MouseClickPlus( "SwgClient", "left", 360 - $borderwidth, 325 - $titleheight, 1 ) _MouseClickPlus( "SwgClient", "left", 425 - $borderwidth, 325 - $titleheight, 1 ) WEnd EndFunc 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 Let me know if it does, if not, I'll see if I can help more. I've referred this site, but never used the function . Edited July 8, 2005 by ronsrules Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Moderators SmOke_N Posted July 10, 2005 Moderators Posted July 10, 2005 (edited) Hmm, I got it to work... And argueing w/ myself for not using it earlier!! expandcollapse popupGlobal $WinTitle = "My Game Window Title Name"; Either your game title name is wrong or something in one of the other comments is Dim $mod = 0, $primary, $secondary _MouseButton($primary, $secondary) Play() Func Play() Opt("MouseClickDelay", 1) Opt( "MouseCoordMode", 0) While WinExists($WinTitle); $j = 0 : While $j <= 10 (this will always be less than 10 if that is all your code) Sleep(500); give the CPU a break If Not WinExists("Windows Task Manager") Then; Does Windows Task Manager always exist? If so it would Always exit the script the way you had it. _MouseClickPlus( $WinTitle, $primary, 430, 260, 1 ) _MouseClickPlus( $WinTitle, $primary, 490, 260, 1 ) _MouseClickPlus( $WinTitle, $primary, 360, 325, 1 ) _MouseClickPlus( $WinTitle, $primary, 425, 325, 1 ) EndIf WEnd EndFunc Func _MouseClickPlus($Window, $primary, $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 $primary $Button = $MK_LBUTTON $ButtonDown = $WM_LBUTTONDOWN $ButtonUp = $WM_LBUTTONUP Case $Button = $secondary $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 Func _MouseButton(ByRef $primary, ByRef $secondary) Local $k $k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons") If $k = 1 Then $primary = "right" $secondary = "left" Else $primary = "left" $secondary = "right" EndIf EndFunc ;==>_MouseButtonPut a few comments in there where I thought you may have ran into the problems. But I'll verify this "IS AWESOME" Thanks so much:::::: "Insolence" and "Larry"!!Edit: BTW... TY Scorpius for revamping this post!! Edited July 10, 2005 by ronsrules Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Christopher Blue Posted March 5, 2007 Posted March 5, 2007 So I gather that this script is like a ControlSend for mouse commands?
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