Help - Search - Members - Calendar
Full Version: a little delay problem with inner loop
AC Tools Everything Macro > AC Tool Macros > Macro Development
SaGaR
Hi all,
i have been experimenting with ACTool for a few weeks now, but now i have come to a point where i can't fix the problem myself

I have a main loop
and i have another loop in it, the inner loop

the problem is that i want the main loop to loop like it should
and the inner loop to loop only every hour,
but i don't know how to do that, i've tried alot of things, but nothing worked,

Here's an example of what i mean:
the code exists only of mouseclicks so i left them away, and instead called it "//code"

CODE
Loop 100
//code
   Loop 1
   //code
      Loop 20
      //code
      end
   end
   delay 180000
end


so i want the main loop(the Loop 100)
to loop 100 times and after every loop to wait for about 3 mins(delay 180000) //This is working so this isn't the problem
and the inner loop(the Loop 1) to loop only every hour //this is what i can't figure out
but when the inner loop waits, the main loop has to continue but i can't figure how to do that, cuz a delay would pause the entire script, and that isn't what i want

I hope someone understands what i mean and what the problem is, and someone can help me:D
Ahk
There's a couple of ways to do this, I think the easiest way will be to use one of the features of Procedures which is used with ProcessMessages.

Procedures can include a few different keywords at the end, Every in this example...a full list is in the help under Procedure.
CODE
Procedure Inner Every 60 min
  //Code
End

Loop 100
//code
   Loop 1
   //code
      Loop 20
      //code
      end
   end
   delay 180000
   ProcessMessages
end


If you care to think about it, you could accomplish the same thing by using Compute, {elapsedmsec}, and an If statement..but this is going to be the easiest route. Check out the help for more info/keywords and code examples.
SaGaR
QUOTE(Ahk @ May 6 2009, 07:17 PM) *
There's a couple of ways to do this, I think the easiest way will be to use one of the features of Procedures which is used with ProcessMessages.

Procedures can include a few different keywords at the end, Every in this example...a full list is in the help under Procedure.
CODE
Procedure Inner Every 60 min
  //Code
End

Loop 100
//code
   Loop 1
   //code
      Loop 20
      //code
      end
   end
   delay 180000
   ProcessMessages
end


If you care to think about it, you could accomplish the same thing by using Compute, {elapsedmsec}, and an If statement..but this is going to be the easiest route. Check out the help for more info/keywords and code examples.


thanksthanksthanks:D
been waiting a while for the solution:D
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.