Lacorte Posted July 12, 2019 Share Posted July 12, 2019 Hi! I have a code for control 2 cursos from 1 mouse. It works, but only to click. I need make some improvements on the second cursor to drag and drop and to click and hold. Anybody can help me? Also, there is any way to make the second cursor looks like the main cursor? Thanks in advance expandcollapse popupHotKeySet("{ESC}", "_exit") HotKeySet("{F10}", "_secondMouse") $mouse = MouseGetPos() $dll = DllOpen("user32.dll") $toggle = 0 #include <Misc.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> $MiceX2 = GUICreate("MiceX2", 184, 92, 192, 124) $xDistanceInput = GUICtrlCreateInput("200", 128, 0, 49, 21) $xInfoLabel = GUICtrlCreateLabel("X Distance from Mouse", 8, 4, 114, 17) $yInfoLabel = GUICtrlCreateLabel("Y Distance from Mouse", 8, 28, 114, 17) $yDistanceInput = GUICtrlCreateInput("0", 128, 24, 49, 21) $hotkeyInfo1 = GUICtrlCreateLabel("Start = F10", 16, 48, 83, 17) $hotkeyInfo1 = GUICtrlCreateLabel("Stop = F9", 16, 64, 83, 17) $hotkeyInfo2 = GUICtrlCreateLabel("Exit = ESC", 16, 78, 54, 17) GUISetState(@SW_SHOW) Opt("GUIOnEventMode", 1) ; Change to OnEvent mode GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") _load() While 1 Sleep(100) WEnd Func _secondMouse() While 1 Sleep(25) $mouse = MouseGetPos() ToolTip("^", $mouse[0] + GUICtrlRead($xDistanceInput) - 10, $mouse[1] + GUICtrlRead($yDistanceInput)) If _IsPressed("01", $dll) Then _mouseClick() If _IsPressed("1B", $dll) Then _save() Exit EndIf If _IsPressed("78", $dll) Then ToolTip("") ExitLoop EndIf WEnd EndFunc ;==>_secondMouse Func _mouseClick() ToolTip("") MouseUp("left") MouseMove($mouse[0] + GUICtrlRead($xDistanceInput), $mouse[1] + GUICtrlRead($yDistanceInput), 0) MouseDown("left") Sleep(50) MouseUp("left") MouseMove($mouse[0], $mouse[1], 0) ToolTip("^", $mouse[0] + GUICtrlRead($xDistanceInput), $mouse[1] + GUICtrlRead($yDistanceInput)) EndFunc ;==>_mouseClick Func _exit() DllClose($dll) _save() Exit EndFunc ;==>_exit Func _save() IniWrite(@ScriptDir & "\MouseX2.ini", "Distance", "X", GUICtrlRead($xDistanceInput, 1)) IniWrite(@ScriptDir & "\MouseX2.ini", "Distance", "Y", GUICtrlRead($yDistanceInput, 1)) EndFunc ;==>_save Func _load() GUICtrlSetData($xDistanceInput, IniRead(@ScriptDir & "\MouseX2.ini", "Distance", "X", "200")) GUICtrlSetData($yDistanceInput, IniRead(@ScriptDir & "\MouseX2.ini", "Distance", "Y", "0")) EndFunc ;==>_load Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 12, 2019 Moderators Share Posted July 12, 2019 What exactly are you trying to accomplish with two mice? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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