Sign in to follow this  
Followers 0
Arnol5

Make my mouse move after a certain

7 posts in this topic

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  

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

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

1 person likes this

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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 

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