Jump to content

GUI Events during Do Until


iNFERiON
 Share

Recommended Posts

Hey all, I'm having a problem. My script is not responding to GUI Events, during a Do...Until method is doing it's work.

The GUI starts responding again after the Do is finished. Is there any way to have it listen for events while it's in the Do ?

Oh yeah, I'm using GUIOnEventMode, so GuiGetMsg() is not an option and putting an additional GuiSetOnEvent in the Do also does not seem to work.

Edited by iNFERiON
Link to comment
Share on other sites

My Do..Until loop is updating a counter every second. So it has plenty to do if the counter is set to like an hour or so.

I just found out that the GUI signal is coming through, but it's just being processed if the Do...Until loop is finished, not earlier.

Link to comment
Share on other sites

  • Moderators

My Do..Until loop is updating a counter every second. So it has plenty to do if the counter is set to like an hour or so.

I just found out that the GUI signal is coming through, but it's just being processed if the Do...Until loop is finished, not earlier.

If you have some actual code to post, you could have your answer solved in a matter of minutes more than likely rather than a matter of hours/days/weeks/possibly never.

It's your problem, so don't make those of us that help out regularly go out of our way to assume what your code is doing.

Now for a guess... I bet you are using "Sleep()" in this Do/Until loop? You might want to look up what sleep does to your script if that's the case.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Yes, there is a sleep in the do, it actually starts with it, since it has to execute the Do with a 1 second delay each time, being a timer and all. Here is the code:

$time_hrs = Int(ControlGetText("","",$hrs))
    $time_min = Int(ControlGetText("","",$min))
    $time_sec = Int(ControlGetText("","",$sec))
    Do
        Sleep(1000)
        
        If $time_hrs > 0 And $time_min = 0 And $time_sec = 0 Then
            $time_hrs = $time_hrs-1
            $time_min = 59
            $time_sec = 60
        EndIf
        
        If $time_min > 0 And $time_sec = 0 Then
            $time_min = $time_min-1
            $time_sec = 60
        EndIf
        
        $time_sec = $time_sec-1
        
        ControlSetText("","",$stopwatch,$time_hrs & ":" & $time_min & ":" & $time_sec)
    Until $time_hrs = 0 And $time_min = 0 And $time_sec = 0
Link to comment
Share on other sites

  • Moderators

Sleep() pauses your script for the period you set... nothing works until it's done with it's timeout... thus the word "sleep".

Create your own timer using... TimerInit()/TimerDiff().

You can keep a sleep in there, but make it a Sleep(10).

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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