Nino Posted July 10, 2005 Share Posted July 10, 2005 Hello, I've been trying to find out how to lock the Y-axis so that you cannot move up or down past a certain point(dead center of the screen for example), but you can turn side to side just not past that vertical point. I was thinking it could be done using MouseMove but I didn't know how to really do it. Any help will be greatly appreciated. Thank you. Nino Link to comment Share on other sites More sharing options...
buzz44 Posted July 10, 2005 Share Posted July 10, 2005 Change the values of $Top and $Bottom to the desired co-ordinates. $Top = 200 $Bottom = 200 _MouseTrap(0, $Top, @DesktopWidth, $Bottom) WHile 1 Sleep(100) WEnd Func _MouseTrap($l_left, $l_top, $l_right, $l_bottom) $v_Rect = DllStructCreate('int;int;int;int') DllStructSetData($v_Rect, 1, $l_left) DllStructSetData($v_Rect, 2, $l_top) DllStructSetData($v_Rect, 3, $l_right) DllStructSetData($v_Rect, 4, $l_bottom) $ai_Ret = DllCall('user32.dll', 'int', 'ClipCursor', 'ptr', DllStructGetPtr($v_Rect)) DllStructDelete($v_Rect) Return $ai_Ret[0] EndFunc qq Link to comment Share on other sites More sharing options...
Nino Posted July 10, 2005 Author Share Posted July 10, 2005 (edited) Thank you for your help. Edit. Confused by this error. $v_Rect = DllStructCreate('int;int;int;int') $v_Rect = ^ERROR Error: Unknown Function name. Edited July 10, 2005 by Nino Link to comment Share on other sites More sharing options...
w0uter Posted July 10, 2005 Share Posted July 10, 2005 get the beta. My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
layer Posted July 10, 2005 Share Posted July 10, 2005 And the BETA is here: http://www.autoitscript.com/forum/index.php?showtopic=10256 FootbaG Link to comment Share on other sites More sharing options...
Nino Posted July 11, 2005 Author Share Posted July 11, 2005 (edited) Awesome it works! Thanks, but i've tried adding to it, it still runs but my 'macros' or 'binds' or whatever don't work. Edit: The problem is that when I execute the program, it directly locks my Y-axis, I tried to make it so that when I hit LShift it would do that(as you can see), but its not working. expandcollapse popupGlobal $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{LShift}", "MouseTrap") HotKeySet("{Home}", "Terminate") $Top = 200 $Bottom = 200 MouseTrap(0, $Top, @DesktopWidth, $Bottom) WHile 1 Sleep(1000) WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func MouseTrap($l_left, $l_top, $l_right, $l_bottom) $v_Rect = DllStructCreate('int;int;int;int') DllStructSetData($v_Rect, 1, $l_left) DllStructSetData($v_Rect, 2, $l_top) DllStructSetData($v_Rect, 3, $l_right) DllStructSetData($v_Rect, 4, $l_bottom) $ai_Ret = DllCall('user32.dll', 'int', 'ClipCursor', 'ptr', DllStructGetPtr($v_Rect)) DllStructDelete($v_Rect) Return $ai_Ret[0] EndFunc Func Terminate() Exit 0 EndFunc Please tell me what I am doing wrong. Thanks in advance. Nino Edited July 11, 2005 by Nino Link to comment Share on other sites More sharing options...
DarkNecromancer Posted July 11, 2005 Share Posted July 11, 2005 hay there, um, im not the best for providing others with code :\ but i gave it a shot and here is something that i think your trying to do. I dont know how much your requirements are for the delay but theres something to look atHotKeySet("{f1}", "lockmouse" ) HotKeySet("{f2}", "unlockmouse" ) HotKeySet("{f3}", "exitprog" ) Global $yaxis = "400" Global $loop = 0 while 1 sleep( 100 ) Wend Func lockmouse() $loop = 1 while $loop = 1 $x = MouseGetPos ( 0 ) MouseMove ( $x, $yaxis , 0 ) Wend EndFunc Func unlockmouse() $loop = 0 EndFunc Func exitprog() exit 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