Sign in to follow this  
Followers 0
sandman

How can I start a timer for a certain amount of time and have the script do something at the end of the time?

5 posts in this topic

Example: I want to have two functions running at the same time, and at first put Sleep() into each of them. But, if one is sleeping, then it makes the other one sleep too, right? How can I have some kind of timer initiate and count time while the other one might still be doing something?


[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Well, first of all - There's no such thing as doing two things at the same time in autoit(this is because your code is being run in one thread only(unless you use Adlib, as /dev/null advised below me, and still (if my memory doesn't fail me) autoit pauses it's current operation(ie. your code) to do the one specified in the adlib function..)))

So, running two functions at the same time is (quite)impossible.

Though if you want to run two functions (and do an delay/wait in one of them), you could use TimerInit() and TimerDiff() to do "manual" sleeps - sort of speak.

Edit:

Clarified, and corrected.

Edited by FreeFry

Share this post


Link to post
Share on other sites

Example: I want to have two functions running at the same time, and at first put Sleep() into each of them. But, if one is sleeping, then it makes the other one sleep too, right? How can I have some kind of timer initiate and count time while the other one might still be doing something?

see AdlibEnable() in the help file.


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I just wrote this post giving an example of how you CAN do multi-threading in autoIt, but then I actually tried it out for myself and it didn't actually work.... so next time I'll experiment BEFORE opening my mouth :">

Edited by Traddles

Share this post


Link to post
Share on other sites

Okay.. thanks both of you.. I'll experiment with both things you mentioned.


[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

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