Thundorin Posted August 17, 2019 Posted August 17, 2019 Hey im looking for a way to execute function2 after function1 has been cycled more then x times. also function2 must reset the counter of function1 cycles. I couldn't think of a code that exactly executes this, does anyone have an idea?
FrancescoDiMuro Posted August 17, 2019 Posted August 17, 2019 Hi @Thundorin, and welcome to the AutoIt forums Use Global variables and For...Next loop: HotKeySet("{ESC}", "ExitApplication") Global $intCounter = 1 While 1 Function1() If $intCounter > 10 Then Function2() Sleep(100) WEnd Func ExitApplication() Exit EndFunc Func Function1() ConsoleWrite("Function1 has been ran " & $intCounter & " times." & @CRLF) $intCounter += 1 EndFunc Func Function2() ConsoleWrite("Function2!" & @CRLF) $intCounter = 1 ConsoleWrite("Counter is now " & $intCounter & @CRLF) Exit EndFunc Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now