MadBoy Posted January 19, 2006 Share Posted January 19, 2006 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) Link to comment Share on other sites More sharing options...
MHz Posted January 19, 2006 Share Posted January 19, 2006 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. 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) Link to comment Share on other sites More sharing options...
MadBoy Posted January 19, 2006 Author Share Posted January 19, 2006 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) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now