AutoIT help - skip a piece of code if it executes

Scorpion Ghost

Elite Member
Executive VIP
Jr. VIP
Joined
Mar 22, 2013
Messages
9,148
Reaction score
10,489
So I have a code that does 3 runs on something. I want if it executes on first run, to skip the other two.

If it doesn't execute on first run, it should continue. But then if it executes on second run, to skip the third one.

11.PNG


Can anyone help me please? Thank you
 
Well what you can do is: make a class variable and than use it
in the code block you want to see if there is a result.

private int resultCode = 0;

and add this variable in your "if" where you wanna check if there is a result

if result > 0 Then
//your code//
resultCode = 1;

and on the part you want to skip you put it as a condition

if resultCode != 1 Then
if result > 0 Then

So if there is a result it will set the resultCode to 1 than on the next if basically it say if resultCode is different than 1 enter this block and there is a nested if to check if this block found a result. So if there is a result on the first if code turn to 1 and it prevent to enter in the if.
 
Last edited:
Back
Top