Jump to content

Multi-Head Mousewrap


lod3n
 Share

Recommended Posts

Similar to this:

http://www.autoitscript.com/forum/index.php?showtopic=27936

Adds functionality based on code from Larry;

http://www.autoitscript.com/forum/index.php?showtopic=19098

But able to handle your screen when @desktopwidth et. all don't report the correct dimensions due to having several monitors. I have three, and this works okay for me.

Global Const $SM_XVIRTUALSCREEN = 76
Global Const $SM_YVIRTUALSCREEN = 77
Global Const $SM_VIRTUALWIDTH = 78
Global Const $SM_VIRTUALHEIGHT = 79

$VIRTUALDESKTOPWIDTH = DLLCall("user32.dll","int","GetSystemMetrics","int",$SM_VIRTUALWIDTH)
$VIRTUALDESKTOPWIDTH = $VIRTUALDESKTOPWIDTH[0]

$VIRTUALDESKTOPHEIGHT = DLLCall("user32.dll","int","GetSystemMetrics","int",$SM_VIRTUALHEIGHT)
$VIRTUALDESKTOPHEIGHT = $VIRTUALDESKTOPHEIGHT[0]

$VIRTUALORIGINX = DLLCall("user32.dll","int","GetSystemMetrics","int",$SM_XVIRTUALSCREEN)
$VIRTUALORIGINX = $VIRTUALORIGINX[0]

$VIRTUALORIGINY = DLLCall("user32.dll","int","GetSystemMetrics","int",$SM_YVIRTUALSCREEN)
$VIRTUALORIGINY = $VIRTUALORIGINY[0]

$ymin = $VIRTUALORIGINY
$ymax = $VIRTUALDESKTOPHEIGHT + $VIRTUALORIGINY - 1

$xmin = $VIRTUALORIGINX
$xmax = $VIRTUALDESKTOPWIDTH + $VIRTUALORIGINX - 1

while 1
    sleep(100)
    $pos = MouseGetPos()
    $mousex = $pos[0]
    $mousey = $pos[1]
    Select
        case $mousex = $xmin
            mousemove($xmax - 1,$mousey,0)
        case $mousex = $xmax
            mousemove($xmin + 1,$mousey,0)
        case $mousey = $ymin
            mousemove($mousex,$ymax-1,0)
        case $mousey = $ymax
            mousemove($mousex,$ymin + 1,0)
    EndSelect
    
WEnd

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
Share on other sites

Are they exactly the same resolution? That's how it's designed. I was thinking about being a bit more precise wit it, using WMI to see how big each montitor was, and where it was relative to each other, but I don't really have time at the moment.

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
Share on other sites

SO nice to see a method for handling multiple monitor setups! I couldn't figure out how to do this! Now I'll be able to bundle this method into my screensavers and a few of my other scripts...

Thanks! :nuke::):D:lol::idea:

Edit: If you find a way to "be a little more precise" to get reliable FULL desktop information, please post it here. I'll do a little poking myself now that I get the general idea from your script :P

Edited by james3mg
"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...