Sign in to follow this  
Followers 0
MadBoy

Timeout of GUICreated window.

3 posts in this topic

How to make a box that was created with GUICreate (with few buttons there) to timeout after 20 seconds from showing up and if no other action is taken. Tried to look for Timeout word in forum or autoit_help file but all i found was MsgBox timeouts.


My little company: Evotec (PL version: Evotec)

Share this post


Link to post
Share on other sites



Here is alittle example for you that times out after 20 seconds like a messagebox. I even added a time label to show the progress to show. :lmao: If this is not exactly what you are looking for then the TimerInit() maybe the key to what you want. I am not sure of the term "showing up without other action" as that could mean almost anything.

#include <GUIConstants.au3>

GUICreate('Sample', 220, 100)
$ok = GUICtrlCreateButton('OK', 20, 20, 50)
$extra = GUICtrlCreateButton('Extra', 140, 20, 50)
$cancel = GUICtrlCreateButton('Cancel', 80, 20, 50)
$label = GUICtrlCreateLabel(0, 100, 60, 50); time label
GUISetState(@SW_SHOW)

$time = TimerInit(); start timer
Do
    $msg = GUIGetMsg()
    GUICtrlSetData($label, Int(TimerDiff($time)/1000)); update time label
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg <= 0
            ContinueLoop
        Case $msg = $ok
            MsgBox(0, '', 'OK pressed')
        Case $msg = $extra
            MsgBox(0, '', 'Extra pressed')
        Case $msg = $cancel
            MsgBox(0, '', 'Cancel pressed')
            Exit
    EndSelect
Until TimerDiff($time) > 20000; check timeout

MsgBox(0, '', 'Timeout happened', 3)

Share this post


Link to post
Share on other sites

Yes!! That's exactly what i wanted. Added it to my code, replaced While 1 with Do and it works fine now! Tnx


My little company: Evotec (PL version: Evotec)

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  
Followers 0