Jump to content

Recommended Posts

Hi all, 

I am looking for a quick tip on why my autoit script crashes when I run a timer. Currently I have this code:

      ....(more code above this)....

          Case $button2
                      function1()
           Case $butTimer
                      _Timer_setTimer($hGUI, 3200, "_timedout")

        ......

         Func _timedout()

                       Msgbox(0, "Timed out", "Time is up!")

          Endfunc

When the button is pressed, my timer starts, correct? It doesnt seem to matter if I have it on button activation or not, after the time goes by for a bit, it crashes. :(

Seemingly when the time is up, my script crashes. 

Thanks for your help!

 

 

Link to comment
Share on other sites

While I know seeing the rest of my code can be beneficial, it's a group effort and I don't want to share everyone's work. Everything works perfectly until the button press that in my mind is starting the timer. Is that correct? I have tested the functioning program that doesn't include the timer and it works fine. It is ONLY when the button for the timer is pressed that the program freezes. 

I have never used timers with autoit before, and am new to the whole timer process. I need a timer I can vary the amount of time for to countdown, when the countdown is complete, the timer will then activate a function. This was just a test timer to see if the idea would work. Can I get general help with trying to make a timer work? 

Link to comment
Share on other sites

I've tried the help file and followed it to the point that the program crashes.  I assume the program crashes because it's not meant to be when a button is pressed, but I just wanted to verify this and see if there were ideas out there. No need to be rude. 

Link to comment
Share on other sites

rude?  Its hard to speculate what is happening in your script if you don't post other parts of it..... Idk what the problem is... you press a button .. time goes by a msgbox pops up.  script is over.  theres not crash just the end.  Again without seeing other parts can't really say much else. your saying an amout of time goes by button press or no and it crashes anyway.  Doubtful this has anything to do with the timer portion but who knows bc we can't see.    using the timer functions are well documented in the help file.  and .... good luck....:D

Link to comment
Share on other sites

The snippet TE posted don't throw's the error. The crash is a result of the code he hasn't posted maybe the real callback func.

And nobody can, without seeing code showing the issue, do more then saying helpfile is your friend, all other is wasted time. Reading in tea leaves and analyzing will give better result => a good cup of tea.

Edited by AutoBert
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

×
×
  • Create New...