Jump to content

Make my mouse move after a certain


Go to solution Solved by Morthawt,

Recommended Posts

Posted

Can i make my mouse move when the X and Y coordinates remain the same for a cetain moment.

I have no Idea how i can put this in some kind of script laguage

If mousePosition = for certain thime Then ...

 

Thank in advance  

Posted

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)
...
...
...
  • Solution
Posted

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

Posted

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.

Posted

It took me a while to get your script working in my script. But i works like a charm now. i'll definitely check out your video's !!

Thanks again for the fast and helpful respons 

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
  • Recently Browsing   0 members

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