xCobra15x

Timer Help

8 posts in this topic

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!

 

 

Share this post


Link to post
Share on other sites



Can we see the rest of the code?

Share this post


Link to post
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? 

Share this post


Link to post
Share on other sites

Idk man I hear the help file is useful good luck 

Share this post


Link to post
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. 

Share this post


Link to post
Share on other sites

Hi @xCobra15x

Example 2 on Help file for _Timer_SetTimer() will help you.
I did not play with this yet, but your code does not look even near to that example.

Happy coding.

Kind Regards
Alien,

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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
1 person likes this

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

  • Similar Content

    • Mungo
      By Mungo
      After an update installation to Win 10 V.1607 (64bit) I have noticed that help does not show formatted properly anymore e.g. with Images missing, tables, headers, sample code mal formatted etc.

      However, if AutoIt3Help.exe is run as Administrator everything works fine.

      I have already uninstalled AutoIt and SciTE for AutoIt and reinstalled both in the latest version.  I have used default locations for the installation under:


      C:\Program Files (x86)\AutoIt3\...
      Any idea?

      Thanks


    • SaeidN
      By SaeidN
      Hi,
      I searched a lot here but didn't find what I want. Most of them were countdown and other stuff and back to 2004.
      I just want a normal timer that when a button on gui is pressed, it starts from 00:00:00 and goes up.
    • rm4453
      By rm4453
      I need to find a way to after x amount of seconds set the Autoit gui's ComboBox to next option available, and if it reaches the end of the list start back at beginning. This way I can cycle through checking if users are connected to a network. The combo is populated via a recursive file search that contains folders with each connected user's username. The ComboBox will contain something like " username\config " for every connected user. So I need to make so it cycles through constantly every X seconds I have the gui functioning, and all that I just can't get this one part to work.

      TL:DR - How do I make so an AutoIt GUI ComboBox will cycle through all of its options every X seconds, and when it reaches bottom of options cycle back to top and continue the process again.

      Thanks! I can't post any code due to NDA sorry...
    • Dequality
      By Dequality
      I honestly didn't try anything yet.
      But i was thinking about my next step would be to try creating a tetris bot for educational purpose only. Last time i created a automation script / bot for ClubPenguin, which was simply made with PixelSearch If NOT(@error) Then , bla bla u know the drill aight, so i thought i would give my self a little harder challenge instead of keep making Pixelbots, i would love to try making a Memory bot or w/e u call , i read something about memory read/record was used for Tetris bots, since i haven't used Memory, i would love to know if anyone could give me a good guide or smth to follow :-) Either a complete tetris bot guide or a guide that explains memory totally in depth ish. :-)
       
       
      Dequality. #ANY-HELP-APPRECIATET
    • Eddi96
      By Eddi96
      Hey guys!
      I need your help again. So I am working on a Project with which I can Logoff a User in a Terminal-Server (Windows Server 2012 R2), logged in as Admin. Then backup the users partition and log him back in. Sounds pretty easy for you guys, right? So my problem is... I seem to not be able to get the User ID. You can see and display the ID in a textfile with:
      Run("query user>>c:\users\example\desktop\helpmeguys.txt") This line just writes a textfile of "query user" on the desktop. This is an example on what it looks like:
       BENUTZERNAME          SITZUNGSNAME       ID  STATUS  LEERLAUF   ANMELDEZEIT
      >wg                                  console                       2  Aktiv                     17    25.07.2016 08:19

      What I need right now is the ID. Any Idea on how to read it off of the Textfile?
      Please give me examples because I am still a rookie!
       
      With kind regards
      Eddi96