Jump to content
Sign in to follow this  
Monkey

How to make Countdown timer

Recommended Posts

Monkey

Hi! Im learning about autoit and i came into inputbox thingy. where you type password.

and i use the inputbox() with a timeout for about 30 secs. but i want a timer to be shown so the user will see how many time is remaining.

A helping hand would be really appreciated!

thanks!

Share this post


Link to post
Share on other sites
seandisanti

Hi! Im learning about autoit and i came into inputbox thingy. where you type password.

and i use the inputbox() with a timeout for about 30 secs. but i want a timer to be shown so the user will see how many time is remaining.

A helping hand would be really appreciated!

thanks!

You're probably going to have to end up doing this one with a custom GUI that looks like an input box. The reason is that your code stops executing while waiting on a response for the user. Or you could go the ugly hack way, and use one of the multithread simulating algorithms on the forum to launch one thread that asks for input, and another that updates the text of the input box with controlsettext()

Share this post


Link to post
Share on other sites
Monkey

You're probably going to have to end up doing this one with a custom GUI that looks like an input box. The reason is that your code stops executing while waiting on a response for the user. Or you could go the ugly hack way, and use one of the multithread simulating algorithms on the forum to launch one thread that asks for input, and another that updates the text of the input box with controlsettext()

thats exactly whats happening, my timer wont start unless i press a button...or the user input something....

sigh....

Share this post


Link to post
Share on other sites
seandisanti

thats exactly whats happening, my timer wont start unless i press a button...or the user input something....

sigh....

search for multi-threading on the forum. you'll see a couple of ways to have 2 sets of code executing. for this particular task it would actually be very easy. you will be able to do what you want with really less than 5 minutes of effort.

Share this post


Link to post
Share on other sites
Drew

I second the idea of a custom GUI. This is very simple using Koda's... and would probably be easier then multi-threading granted you've had no prior experience.

Share this post


Link to post
Share on other sites
jvanegmond

search for multi-threading on the forum. you'll see a couple of ways to have 2 sets of code executing. for this particular task it would actually be very easy. you will be able to do what you want with really less than 5 minutes of effort.

Even though we just had an argument in another thread. I would like to point out that using multi threading is not your over the counter solution for a programming challenge. With something as trivial as creating a GUI with a time out, I think that multi threading should not be used.

I spent a bit of time searching around and found this article that explains why multi threading is not a good idea: http://www.codingwithoutcomments.com/2008/...ot-a-good-idea/

I've immediately quoted a part of it and put it in my signature. I personally think it describes many cases where multi threading may have not been such a good idea after all.

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  

×