i've updated the script slightly. it now calculates the "virtual" desktop covered by all of the monitors. it doesn't detect monitors being enabled/disabled so the script has to rerun if you are changing that kind of thing. it seems to work correctly, but then, i've based it on my inverted T screen layout (2 on top in the middle, 3 in a row along the bottom): 3 in a row works, 2 vertical works, all 4 works, and 1 main monitor works.
i have a request (that i know skwire knows the answer to), for switching the mouse cursor icon to another one - but only whilst the slide cursor function is in operation. i just think it would be nice if a giant cursor appeared whilst the sliding occured. i've had a look on the autohotkey forum but the dllcall function they are talking about for cursor swapping is beyond me.
i might try adding something to the script to detect which monitor the cursor is on. it might be handy for the cursor to travel automatically to the side and then up when trying to slide the cursor from the edge screen(s) to the top screen (and down and across when moving from the top screen to the side screens).
something like:
make cursor slide up
if cursor is on middle screen then slide up
else if cursor is on left screen then slide to right then up
else slide cursor to left and up
that sounds simple enough to my basic understanding of autohotkey.
i may also attempt to make the cursor slow down as it approaches the edges of the screen (as it did using the original MouseMove function).
here's the new script anyway.
SysGet, VirtualScreenLeft, 76 ; get the dimensions of the virtual desktop (all screens)
SysGet, VirtualScreenWidth, 78
SysGet, VirtualScreenTop, 77
SysGet, VirtualScreenHeight, 79
CoordMode, Mouse, Screen ; make mouse coordinates relative to screen not active window
Hotkey, #k, MoveUp
Hotkey, ^!+k, MoveUp ; * to work with programmable mouse buttons (if winkey not accepted)
Hotkey, ^!+j, MoveDown
Hotkey, #j, MoveDown ; *
Hotkey, #+j, MoveLeft
Hotkey, ^!+h, MoveLeft ; *
Hotkey, #+k, MoveRight
Hotkey, ^!+l, MoveRight ; *
horizontalspeed = 0 ; 0 = fastest, 100 = slowest
verticalspeed =0
verticalspeedmultiplier = 50 ; cursor movement needs speeding up a bit
horizontalspeedmultiplier = 70
borderstop = 100 ; border around screens to halt cursor slide
mainscreenwidth = 1920 ; width of monitor
TopEdge := VirtualScreenTop + borderstop ; topmost monitor edge
BottomEdge := VirtualScreenHeight + VirtualScreenTop - borderstop ; bottommost monitor edge
LeftEdge := VirtualScreenLeft + borderstop ; leftmost monitor
RightEdge := VirtualScreenWidth + VirtualScreenLeft - borderstop ; rightmost monitor edge
FudgeFactor=10 ; margin of error for vertical slides
FudgeFactorHorizontal=2 ; margin of error for horizontal slides
MoveUp:
;CoordMode, Mouse, Screen
loop
{
If ( xpos_
< ( xpos
- FudgeFactor
) OR ( xpos_
> ( xpos
+ FudgeFactor
) ) ) ypos -= verticalspeedmultiplier
;if ypos = 0
}
MoveDown:
;CoordMode, Mouse, Screen
loop
{
If ( xpos_
< ( xpos
- FudgeFactor
) OR ( xpos_
> ( xpos
+ FudgeFactor
) ) ) ypos += verticalspeedmultiplier
;if ypos = %screenheight%
}
MoveLeft:
loop
{
If ( ypos_
< ( ypos
- FudgeFactorHorizontal
) OR ( ypos_
> ( ypos
+ FudgeFactorHorizontal
) ) ) xpos -= horizontalspeedmultiplier
;if xpos = 0
}
MoveRight:
loop
{
If ( ypos_
< ( ypos
- FudgeFactorHorizontal
) OR ( ypos_
> ( ypos
+ FudgeFactorHorizontal
) ) ) xpos += horizontalspeedmultiplier
;if xpos = %mainscreenwidth%
}