Sign in to follow this  
Followers 0
Paulie

Loop the mouse

9 posts in this topic

How do you make the mouse shift sides

like if you hit the left side of you'r screen, but keep moving the muse left, then you move striaght across to the right side, and can go left again, like your screen didn't really end

and same for all other sides

Share this post


Link to post
Share on other sites



That's called "The donut effect" or in games like civ "Donut Mapping"

It is very possible actually (in my theory)

I'll get to work on it. :D


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Re-Copy it, edited

I've got to go, but you can use this as a concept :D

#include <GUIConstants.au3>
#include <_MouseHover.au3>

; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 10, @DesktopHeight, 1270, 1)
$Button1 = GUICtrlCreateButton("AButton1", 1, 1, 9, @DesktopHeight)
GUISetState(@SW_SHOW)
WinSetTrans("AForm1", "", 1)
WinSetOnTop("AForm1", "", 1)

AdlibEnable("_ProcessHover", 50)

_HoverAddCtrl($Button1)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;;;;;
    EndSelect
WEnd
Exit

Func _HoverFound($ControlID)
    Switch $ControlID
        Case $Button1
            GUICtrlSetData($ControlID, "Pressing is prohibited!")
    EndSwitch
EndFunc

Func _HoverLost($ControlID)
    Switch $ControlID 
        Case $Button1
            MouseMove(50, 50, 0)
    EndSwitch
EndFunc

Func _ProcessHover()
    $ControlID = _HoverCheck()
    If IsArray($ControlID) Then
        If $ControlID[0] = "AcquiredHover" Then
            _HoverFound($ControlID[1])
        Else
            _HoverLost($ControlID[1])
        EndIf
    EndIf
EndFunc

Must have the mouse hover func

Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>
#include <_MouseHover.au3>

; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 10, @DesktopHeight, 1275, 1)
$Form2 = GUICreate("AForm2", 10, @DesktopHeight, 1, 1)
GUISwitch($Form1)
$Button1 = GUICtrlCreateButton("AButton1", 1, 1, 9, @DesktopHeight)
GUISetState(@SW_SHOW)
WinSetTrans("AForm1", "", 1)
WinSetOnTop("AForm1", "", 1)
GUISwitch($Form2)
$Button2 = GUICtrlCreateButton("AButton1", 1, 1, 9, @DesktopHeight)
WinSetTrans("AForm2", "", 1)
WinSetOnTop("AForm2", "", 1)

AdlibEnable("_ProcessHover", 50)

_HoverAddCtrl($Button1)
_HoverAddCtrl($Button2)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
       ;;;;;;;
    EndSelect
WEnd
Exit

Func _HoverFound($ControlID)
    Switch $ControlID
        Case $Button1
            GUICtrlSetData($ControlID, "Pressing is prohibited!")
        Case $Button2
            GUICtrlSetData($ControlID, "Pressing is prohibited!")
    EndSwitch
EndFunc

Func _HoverLost($ControlID)
    Switch $ControlID 
    Case $Button1
            $pos = MouseGetPos()
            MouseMove(20, $pos[1], 0)
    Case $Button2
        $pos = MouseGetPos()
        MouseMove(1270, $pos[1], 0)
    EndSwitch
EndFunc

Func _ProcessHover()
    $ControlID = _HoverCheck()
    If IsArray($ControlID) Then
        If $ControlID[0] = "AcquiredHover" Then
            _HoverFound($ControlID[1])
        Else
            _HoverLost($ControlID[1])
        EndIf
    EndIf
EndFunc

This should work perfectly, but I can't figure out why it won't create Form2 :D


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

@Firestrom: edited your script, works perfectly now, for me atleast!

Used some of Larry's funcs.

#include <GUIConstants.au3>
#include <_MouseHover.au3>
;~ #NoTrayIcon

; == GUI generated with Koda ==
$fake = GUICreate("")
$Form1 = GUICreate("AForm1", @DesktopWidth+10, @DesktopHeight+10, -10, -10, -1, -1, $fake)
$Button1 = GUICtrlCreateButton("AButton1", @DesktopWidth-2, 0, 9, @DesktopHeight)
WinSetTrans("AForm1", "", 1)
WinSetOnTop("AForm1", "", 1)
$Button2 = GUICtrlCreateButton("AButton1", 0, 0, 9, @DesktopHeight)

$x = CreatePolyRgn("0,0,3,0,3," & @DesktopHeight & ",0," & @DesktopHeight & ",0,0")
$y = CreatePolyRgn(@DesktopWidth-1 & ",0," & @DesktopWidth+3 & ",0," & @DesktopWidth+3 & "," & @DesktopHeight+3 & "," & @DesktopWidth-1 & "," & @DesktopHeight & "," & @DesktopWidth-3 & ",0")

CombineRgn($x, $y)

SetWindowRgn($Form1, $x)


GUISetState(@SW_SHOWNA)

AdlibEnable("_ProcessHover", 50)

_HoverAddCtrl($Button1)
_HoverAddCtrl($Button2)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
       ;;;;;;;
    EndSelect
WEnd
Exit

Func _HoverLost($ControlID)
    Switch $ControlID
        Case $Button1
            GUICtrlSetData($ControlID, "Pressing is prohibited!")
        Case $Button2
            GUICtrlSetData($ControlID, "Pressing is prohibited!")
    EndSwitch
EndFunc

Func _HoverFound($ControlID)
    Switch $ControlID
        Case $Button1
            $pos = MouseGetPos()
            MouseMove(20, $pos[1], 0)
        Case $Button2
            $pos = MouseGetPos()
            MouseMove(1024, $pos[1], 0)
    EndSwitch
EndFunc

Func _ProcessHover()
    $ControlID = _HoverCheck()
    If IsArray($ControlID) Then
        If $ControlID[0] = "AcquiredHover" Then
            _HoverFound($ControlID[1])
        Else
            _HoverLost($ControlID[1])
        EndIf
    EndIf
EndFunc

Func CreatePolyRgn($pt)
    Local $ALTERNATE = 1
    Local $buffer = ""

    $pt = StringSplit($pt,",")
    For $i = 1 to $pt[0]
        $buffer = $buffer & "int;"
    Next
    $buffer = StringTrimRight($buffer,1)
    $lppt = DllStructCreate($buffer)
    For $i = 1 to $pt[0]
        DllStructSetData($lppt,$i,$pt[$i])
    Next
    $ret = DllCall("gdi32.dll","long","CreatePolygonRgn", _
            "ptr",DllStructGetPtr($lppt),"int",Int($pt[0] / 2), _
            "int",$ALTERNATE)
    $lppt = 0
    Return $ret[0]
EndFunc

Func SetWindowRgn($h_win, $rgn)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1)
EndFunc

Func CombineRgn(ByRef $rgn1, ByRef $rgn2)
    DllCall("gdi32.dll", "long", "CombineRgn", "long", $rgn1, "long", $rgn1, "long", $rgn2, "int", 2)
EndFuncoÝ÷ ح§¢Øî²×h¶¬jëh×6
While 1
    $pos = MouseGetPos()
    Select
        Case $pos[0] < 1
            MouseMove(@DesktopWidth, $pos[1], 0)
        Case $pos[0] > @DesktopWidth - 2
            MouseMove(0, $pos[1], 0)
    EndSelect
    Select
        Case $pos[1] < 1
            MouseMove($pos[0], @DesktopHeight, 0)
        Case $pos[1] > @DesktopHeight - 2
            MouseMove($pos[0], 0, 0)
    EndSelect
    Sleep(100)
WEnd

Alzo


Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites

But, why not just do this:

While 1
    $pos = MouseGetPos()
    Select
        Case $pos[0] < 1
            MouseMove(@DesktopWidth, $pos[1], 0)
        Case $pos[0] > @DesktopWidth - 2
            MouseMove(0, $pos[1], 0)
    EndSelect
    Select
        Case $pos[1] < 1
            MouseMove($pos[0], @DesktopHeight, 0)
        Case $pos[1] > @DesktopHeight - 2
            MouseMove($pos[0], 0, 0)
    EndSelect
    Sleep(100)
WEnd

I realized I could do that right as I was leaving :D


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Thanks guys, the while/wend loop is perfect for what i need, i think i am going to use it to write a udf for it

"_MouseDonut" maybe?

that would be fun, i just hope it hasn't been done already

Edited by Paulie

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Actually, I believe someone has, looking it up now...

Edit: found it here.

Edited by marfdaman

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites

Actually, I believe someone has, looking it up now...

Edit: found it here.

That's mine! Nice that you found it.

It's a really easy thing to do.


http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script]

Share this post


Link to post
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
Sign in to follow this  
Followers 0