Jump to content

Recommended Posts

Posted

Hello everyone,

I am very new to all of this but I have used Macro Express for years. In Macro Express there are a few functions I am trying to replicate. One of them being a Wait for Mouse Cursor (Pick what cursor to wait for).

AutoIt so far seems to be vastly more powerful and I figured I would start rewriting some macros I have in macro express.

My Question Is: Am I on the right track with this or am I way off?

Global $ScreenCoords = @SCRIPTDIR & '\My Screen Coords.ini'
Global $RandomTime = Random (500, 1500, 1)
Global $Cursor = MouseGetCursor ()

Func MouseMoveToScreen1 ()

$x = IniRead ($ScreenCoords, "Key 1", "X", "Not Found")
$y = IniRead ($ScreenCoords, "Key 1", "y", "Not Found")

If $Cursor = 2 Or 5 Then
    mousemove ($x ,$y ,0)
Else
Sleep (5000)
EndIf

EndFunc

Call("MouseMoveToScreen1")
Sleep ($RandomTime)

I would really like the sleep command to be indefinite. If someone could point me in the right direction that would be great.

Posted (edited)

Thanks for the reply, and such a quick one.

By "'wait for mouse cursor" think about the cursor being an hourglass (busy). I want it to wait until the mouse cursor returns to the default pointer.

I have tried the While 1 WEnd and got stuck in some infinite loop even though my mouse pointer clearly changed. But looking at it now I think I am just putting the While 1 in the wrong spot. :unsure:

Edited by Smedric
Posted

Just like your second example.

Do
    Sleep ( 1000 )
Until MouseGetCursor ( ) = 2

I tried this about 1000 times with no result other then just blasting to the next set of mouse move. I tested by changing the 2 to 16 then hovering over the play button on netflix and it works great. I have no idea why when I used this option before it never worked. Is there some sort of minimum Sleep time that needs to be used?

Or perhaps it could be because I tried:

Do
    Sleep ( 1000 )
Until MouseGetCursor ( ) = 2 Or 5

Testing that code using 14 Or 16 it just runs right into the next step. I am obviously using the Or function wrong.

Thank you for helping me get one step further.

Posted

Nice! Simple solution. I have so much reading to do. I tried many If statements, loops and etc... Having basically no programing language experience this is turning out to be fun.

Thanks for your help.

Posted

Nice! Simple solution. I have so much reading to do. I tried many If statements, loops and etc... Having basically no programing language experience this is turning out to be fun.

Thanks for your help.

Thanks, you will love AutoIt like anybody after test it !

Glad to help you ! Posted Image

AutoIt 3.3.18.0 X86 - SciTE 4.4.6.0WIN 11 24H2 X64 - Other Examples Scripts

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
×
×
  • Create New...