Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MouseX -> MonitorX
#1
I have two monitors, two keyboards, two mice, and one computer (a laptop).

I'm using the multi-monitor taskbar.

What I'd like:
mouse1 movement -> pointer focuses center monitor1
mouse2 movement -> pointer focuses center monitor2

Would the best way to go about it.

Thanks,
Jimmy Vig
#2
This was quite simple.

Function Mouse_1
Trigger #>2m1 0x1 //FF_Mouse1     Help - how to add the trigger to the macro
Code:
Copy      Help
mou 1750 309

Function Mouse_2
Trigger #>2m2 0x1 //FF_Mouse2     Help - how to add the trigger to the macro
Code:
Copy      Help
mou 555 325

Is there a better way to have the mouse move center Monitor 1 and 2?
#3
This works if you use keyboard/mouse detector.

Function two_mouse_pointers
Code:
Copy      Help
type TMP_PREV mouse_id POINT'p
TMP_PREV+ __tmp_p

if(g_ri.mouse_id=__tmp_p.mouse_id) ret

if __tmp_p.mouse_id
,POINT p; GetCursorPos &p
,SetCursorPos __tmp_p.p.x __tmp_p.p.y
,OnScreenDisplay "\" -1 p.x-3 p.y-6 "Courier New" 0 0xff 16 "tmp_prev_pos"
,__tmp_p.p=p

__tmp_p.mouse_id=g_ri.mouse_id

Call it in function RI_Input, above case RIM_TYPEHID:
Code:
Copy      Help
,two_mouse_pointers
#4
This is wicked cool.

How would I lock each cursor to it's own monitor? I don't like it when it runs over to the other screen when I'm trying to use a scroll bar or something.

Thanks,
Jimmy Vig
#5
Function two_mouse_pointers
Code:
Copy      Help
;/Keyboard_Detector

;Creates two virtual pointers to be used by two mouses.
;If there are two monitors, each pointer will be in its monitor.

;Requires Keyboard_Detector. If don't have it, download from http://www.quickmacros.com/forum/viewtopic.php?p=2747
;In Keyboard_Detector dialog must be enabled multiple mouses, and filter functions assigned to mouses. To open the dialog, run Keyboard_Detector or this function 2 times.
;Also need to edit function RI_Input. Before line " case RIM_TYPEHID" insert line "two_mouse_pointers" (tab-indented).

;You can change this variable:
;;;0 all cursors can be anywhere;
;;;1 each cursor must be in its monitor;
;;;2 cursors must be in left or right side of primary monitor. This is for testing on single monitor.
;After changing, click Compile button. Or assign a global variable, and then can change from other macro.
int clipCursor=1
;int+ g_clipCursor; clipCursor=g_clipCursor ;;with global variable

;_______________________________________

type TWOMPDATA mouse_id POINT'p clipCursor RECT'r
TWOMPDATA-- t

POINT p; GetCursorPos &p

if g_ri.mouse_id=t.mouse_id  ;;same mouse
,if(clipCursor!=t.clipCursor) ClipCursor 0; goto g1
,if clipCursor
,,if t.r.right>t.r.left and !PtInRect(&t.r p.x p.y)
,,,if(p.x<t.r.left) p.x=t.r.left
,,,if(p.x>=t.r.right) p.x=t.r.right-1
,,,if(p.y<t.r.top) p.y=t.r.top
,,,if(p.y>=t.r.bottom) p.y=t.r.bottom-1
,,,ClipCursor &t.r
,,,SetCursorPos p.x p.y; GetCursorPos &p
,ret

ClipCursor 0

if t.mouse_id
,SetCursorPos t.p.x t.p.y
,OnScreenDisplay "\" -1 p.x-3 p.y-6 "Courier New" 0 0xff 16 "two_mouse_pointers"
,atend OsdHide ""
,t.p=p
t.mouse_id=g_ri.mouse_id

;g1
t.clipCursor=clipCursor
SetRectEmpty &t.r
if clipCursor
,for _i 0 4
,,if g_ri.mouse_id=g_rir.m[_i]
,,,if(t.clipCursor=1) MonitorFromIndex(_i+1 0 &t.r)
,,,else t.r.right=ScreenWidth; t.r.bottom=ScreenHeight; if(_i=0) t.r.right/2; else t.r.left=t.r.right/2
,,,ClipCursor &t.r
,,,atend ClipCursor 0
,,,break

;info:
;ClipCursor is not necessary, but prevents cursor shaking.
;Cannot use only ClipCursor because it works temporarily.
#6
This is absolutely perfect! I think I reduced my annual mouse miles by about 1/3. Thank you so much -Jimmy Vig
#7
Odd thing is that after I move a window, the lock turns off until I move the other mouse.

Is that the way it is supposed to work so windows can be dragged over from one monitor to another?

Also releases when the "Start" menu is clicked.

And when any window is created.
#8
Updated. Now restores cursor clipping.


Forum Jump:


Users browsing this thread: 1 Guest(s)