Jump to content

Mouse Wrap


AutoItKing
 Share

Recommended Posts

  • 1 year later...

How can I edit this script to make the mouse wrap functionality work on a toggle? ie, rather than esc exiting the script, it will either turn on mousewrap or, if mousewrapping is on, turn it off?

I've tried a couple things:

HotKeySet("{Esc}","_MouseWrap")

$off = True

Func _MouseWrap()

If $off = True Then

While 1

$pos = MouseGetPos()

$off = False

If $pos[0] < 2 Then MouseMove(@DeskTopWidth - 2, $pos[1], 1)

If $pos[0] > @DeskTopWidth - 2 Then MouseMove(2, $pos[1], 1)

Sleep(1)

Wend

ElseIf $off = False Then

$off = True

EndIf

EndFunc

But I am brand new to all this, so I don't know where to go from here. Any help would be much appreciated.

Link to comment
Share on other sites

How can I edit this script to make the mouse wrap functionality work on a toggle? ie, rather than esc exiting the script, it will either turn on mousewrap or, if mousewrapping is on, turn it off?

I've tried a couple things:

HotKeySet("{Esc}","_MouseWrap")

$off = True

Func _MouseWrap()

If $off = True Then

While 1

$pos = MouseGetPos()

$off = False

If $pos[0] < 2 Then MouseMove(@DeskTopWidth - 2, $pos[1], 1)

If $pos[0] > @DeskTopWidth - 2 Then MouseMove(2, $pos[1], 1)

Sleep(1)

Wend

ElseIf $off = False Then

$off = True

EndIf

EndFunc

But I am brand new to all this, so I don't know where to go from here. Any help would be much appreciated.

HotKeySet("{Esc}","_Exit")
HotKeySet("!{Esc}","_Switch")
Global $wrap = True
_MouseWrap()

Func _MouseWrap()
    TrayTip("hot key:","press Esc to exit" & @LF & "Alt Esc to turn wrap on/off",30)
    While 1
        $pos = MouseGetPos()
        If $wrap Then
            If  $pos[0] < 2 Then MouseMove(@DeskTopWidth - 2, $pos[1], 1)
            If $pos[0] > @DeskTopWidth - 2 Then MouseMove(2, $pos[1], 1)
            If $pos[1] < 2 Then MouseMove($pos[0], @DesktopHeight - 2, 1)
            If $pos[1] > @DeskTopHeight - 2 Then MouseMove($pos[0], 2, 1)
        EndIf

        Sleep(1)
    Wend
EndFunc

Func _Exit()
    Exit
EndFunc

Func _Switch()
    $wrap = Not $wrap
EndFunc
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...