mati Posted May 26, 2017 Share Posted May 26, 2017 Hi, I wish to create a GUI that shows a countdown but stays in the background as infobox while other tasks continue. So far I have with use of other snippets from the forum created a countdown but the GUI seems block the script from continuing. How can I 'deactivate' the GUI but keep the countdown running? The GUI box should close at the end of the main script (or after countdown end). Thanks for help, mati #include <GUIConstants.au3> #include <Date.au3> $sNewDate = _DateAdd('n', 1, _NowCalc()) $ms = 61000 ;(1 min) $timer = TimerInit() $labeltext1 = "This run will be finished in" $labeltext2 = "minutes at: " & _DateTimeFormat($sNewDate, 3) ; $GUI = GUICreate("Next start", 170, 170, 150,150, $WS_DLGFRAME, $WS_EX_TOPMOST) $Install = GUICtrlCreateButton ("Ok", 50, 95, 50, 50, $BS_DEFPUSHBUTTON) $Label1 = GUICtrlCreateLabel($labeltext1, 10, 10, 330, 200) $Label2 = GUICtrlCreateLabel($labeltext2, 25, 80, 330, 200) $Input = GUICtrlCreateInput("", 50, 40, 35, 20, BitOR($SS_CENTER, $ES_READONLY)) $aWin = WinGetPos($GUI) GUISetState(@SW_SHOWNOACTIVATE) While (TimerDiff($timer) < $ms) and (GUIGetMsg() <> $Install) ; $seconds = TimerDiff($timer) / 1000 $diff = $seconds - ($ms / 1000) ; $minutes = Int($diff / 60) $secondsRem = $diff - ($minutes * 60) ; $minutes = $minutes * -1 $secondsRem = $secondsRem * -1 $time = StringFormat("%02d", $minutes) & ":" & StringFormat("%02d", $secondsRem) ; GUICtrlSetData($Input, $time) ; WEnd ; just for test purpose WinActivate("AutoIt Help (v3.3.14.2)") WinWaitActive("AutoIt Help (v3.3.14.2)") WinClose("AutoIt Help (v3.3.14.2)") Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 26, 2017 Share Posted May 26, 2017 Hi @mati What are you trying to do? And please, use the Code tag to make a good reading of your post, thanks Best regards. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
mati Posted May 30, 2017 Author Share Posted May 30, 2017 Hi FrancescoDiMuro, Sorry for the code thing - rookie mistake. What I try to do: I have two processes I control with AutoIt. Process 1 is variable in time, directly followed by process 2 which is consistent in duration. After starting the script, I never know, when the entire script will be finished. So I thought, it would be helpful to implement a function between the two processes, which starts a countdown (or shows an expected finishing time). However, if I use a msgbox or GUI, I have to destroy the box to continue the script (process 2). Is there a possibility to 'inactivate' a GUI window (message box) so that the scrip can continue but the countdown/expected finishing time is still displayed on the screen? Thanks a lot for help, mati 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