Sign in to follow this  
Followers 0
deano

i need help.

3 posts in this topic

Ok, How do i put a timelimit kinda thingy, To my function?

As in, If my _sendabc() function took longer then 60 seconds, i would like it to exit the Do Loop, And call the _tooktolong() func, how can this be done?

And i can't take out the do loop in _sendabc(), my script needs it.

here is an example(this is not my actual script)

Func _sendabc()

local $int = 0

do

send("abc")

$int = 1

Until $int = 1

if not @error And $int = 1 Then

return 1

Else

return 0

Endif

Endfunc

Func _tooktolong()

tooltip("_sendabc took longer then 60seconds.",0,0)

return 1

Endfunc

i've been trying to do it for hours, please help if you can.

Share this post


Link to post
Share on other sites



You need to use TimerInit() and TimerDiff(). Call TimerInit() before the start of your loop, and call TimerDiff() inside the loop to check the timeout has not occurred. If it has, exit the loop (either with ExitLoop or a condition in the Until statement).

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