Smedric 0 Posted May 19, 2011 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. Share this post Link to post Share on other sites
wakillon 403 Posted May 19, 2011 Use a loop instead of sleep for infinite time :While 1WEndAnd what do you mean by "Wait for Mouse Cursor" ?Wait for cursor move ? AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
Smedric 0 Posted May 19, 2011 (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. Edited May 19, 2011 by Smedric Share this post Link to post Share on other sites
wakillon 403 Posted May 19, 2011 (edited) Like this ? While 1 If MouseGetCursor ( ) = 2 Then Exitloop ; 2 is arrow cursor sleep ( 1000 ) WEnd or like this Do Sleep ( 1000 ) Until MouseGetCursor ( ) = 2 Script wait until default cursor is back. Edited May 19, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
Smedric 0 Posted May 19, 2011 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. Share this post Link to post Share on other sites
wakillon 403 Posted May 19, 2011 Do Sleep ( 1000 ) Until MouseGetCursor ( ) = 2 Or MouseGetCursor ( ) = 5 AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
Smedric 0 Posted May 19, 2011 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. Share this post Link to post Share on other sites
wakillon 403 Posted May 19, 2011 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 ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites