SjaakTV Posted April 12, 2010 Share Posted April 12, 2010 Hi, So if managed to get a new problem. I have 2 functions. The thing I want to do with these 2 functions is that function 1 runs for 5minutes and then function 2 will run one time. I want to have this looped. Someone told me about this: $timer = TimerInit() while(1==1) if(TimerDiff($timer) >= 300000) then F2() ExitLoop But first of all i think this is good but i can't put it in my code. Tried much ways. Lets say func1 is Func F1() MouseClick ("Left",1,211) sleep (5000) endfunc And func2 is Func F2() send ("{ENTER}") MouseClick ("left", 22,239,3) endfunc The first code keeps telling me that it needs a wend or that the endfunc is placed wrong. Idk what it is... Thnx for your help. Link to comment Share on other sites More sharing options...
Makaule Posted April 12, 2010 Share Posted April 12, 2010 You could just use something like this: $Timedif = 300 ;difference in seconds $Timer = TimerInit() While 1 If (TimerDiff($Timer)/1000) < $Timedif Then F1() Else F2() $Timer = TimerInit() EndIf WEnd Talking about your code you are missing Wend (While ... Wend) and you are missing new TimerInit(), that means after first F2 work there would be always more time then 5mins and first it would work good, later it would just do F2 function. Link to comment Share on other sites More sharing options...
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