Jump to content

Make my mouse move after a certain


Arnol5
 Share

Go to solution Solved by Morthawt,

Recommended Posts

So i have a bunch of If and else functions insida a wile function in my script but when my program freezes my mouse won't move. So than the mouse has to restart the program.

But i don't seem to get how i have to put the time indication and sutch.

MouseGetPos ()
If $array[0] And $array[1] = $array[0] And $array[1] for 500 Then
   MouseMove($array[0]-50,$array[1]-100)
   MouseClick($array[0]-50,$array[1]-100)
...
...
...
Link to comment
Share on other sites

  • Solution

Global $Previous, $Current ; create these variables to begin with
While 1 ; Do this forever
    $Current = MouseGetPos(0) & 'x' & MouseGetPos(1) ; Put the current mouse coordinates into the $Current variable
    If $Previous = $Current Then ; If the $Previous recorded location matches the current one then...
        MouseMove((@DesktopWidth / 2), (@DesktopHeight / 2) + 20, 2) ; Move the mouse to the middle of the screen, 20 pixle down
        MouseMove((@DesktopWidth / 2), (@DesktopHeight / 2), 2) ; Move the mouse to the middle of the screen.
        ConsoleWrite('Moved the mouse due to inactivity' & @CRLF) ; Write to the console view at the bottom of Scite editor when it moves the mouse.
    EndIf
    $Previous = MouseGetPos(0) & 'x' & MouseGetPos(1) ; Set the previous mouse to what it is after it was moved by the program.
    Sleep(5000) ; 5 seconds (5000 milliseconds)to wait before checking
WEnd

Link to comment
Share on other sites

Also, if you want help with learning Autoit, if you click the link under my posts in the signature area you will get access to youtube videos I have made that cover the basics of how to get started. I have had good feedback on them also, so feel free to check those out.

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...