Jump to content

How to make Countdown timer


Monkey
 Share

Recommended Posts

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!

Link to comment
Share on other sites

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()
Link to comment
Share on other sites

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....

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...