Sign in to follow this  
Followers 0
TraumFabriK

Newbie need help with a loop

6 posts in this topic

Func XXX() 
    $m = 0
    While $m <= 19
    MouseClick("left", 400, 640)
    Sleep (3000)
    Send ("{space}")
    Sleep (1000)
    Send ("{space}")
    Sleep (1000)
    MouseClick("left", 560, 940)
    Sleep (Random(2000, 3000, 1))
    MouseClick("left", 520, 285)
    Sleep (Random(310000, 330000, 1))
    $m = $m + 1
    WEnd
EndFunc

Hi guys, I need to add a "check" to this function to restart the function itself after a mouse click (the first random sleep).

I've got the check working:

If $PixC = 0xD5864E Then

but I'm stuck 'cause i don't know how to restart the function.

Is what I'am trying to achieve possible?

Ty in advance to any one willing to help :)

Share this post


Link to post
Share on other sites



If $PixC = 0xD5864E Then XXX()


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Eek. Recursion alert! If your check is true then set a flag and exit the loop. Outside of the loop, check the flag to know whether to re-start the function or not. Probably needs another While/Wend to check it.

WBD

Share this post


Link to post
Share on other sites

Eek. Recursion alert! If your check is true then set a flag and exit the loop. Outside of the loop, check the flag to know whether to re-start the function or not. Probably needs another While/Wend to check it.

WBD

Ty :)

Share this post


Link to post
Share on other sites

Ty :)

Something Like;

While 1
If $PixC = 0xD5864E Then XXX()
Sleep(100)
Wend

Func XXX()
    $m = 0
    While $m <= 19
    MouseClick("left", 400, 640)
    Sleep (3000)
    Send ("{space}")
    Sleep (1000)
    Send ("{space}")
    Sleep (1000)
    MouseClick("left", 560, 940)
    Sleep (Random(2000, 3000, 1))
    MouseClick("left", 520, 285)
    Sleep (Random(310000, 330000, 1))
    $m = $m + 1
    WEnd
EndFunc

Share this post


Link to post
Share on other sites

Post what you have now and we can fix any recursion problems quickly


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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