mentosan Posted May 8, 2009 Posted May 8, 2009 Hi ! I want to add a countdown timer to the MsgBox(). Is this possible ? Thank you.
notsure Posted May 8, 2009 Posted May 8, 2009 The MSGBOX is static as far as i know. Alternative would be to build a form just like a MSGBOX.
Juvigy Posted May 8, 2009 Posted May 8, 2009 The MSGBOX has a built in countdown timer functionality. It is just not visible .If you need it visible you will have to create a GUI
BrettF Posted May 8, 2009 Posted May 8, 2009 Create your own GUI as suggested... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
rover Posted May 8, 2009 Posted May 8, 2009 Hi ! I want to add a countdown timer to the MsgBox(). Is this possible ? Thank you.@mentosan search for 'MsgBox countdown' your choice if you want to mod MsgBox() or roll your own with Guicreate() AdlibEnable/setTimer method - MsgBox with countdown on buttons and/or title includes example and more links other msgbox authors scripts How to add this type of countdown w/o new boxes?, So no flicker and dimming ... xMsgBox - ProgAndy xMsgBox - ProgAndy an modified example of ProgAndy's msgbox with SetWindowsHookEx Add a drop shadow to native AutoIt GUI Forms and Dialogs, Minimum OS Windows XP another one by CyberSlug MsgBox with countdown (GUI) I see fascists...
mentosan Posted May 8, 2009 Author Posted May 8, 2009 I have found this code here on the forum and I would like to use it in my script. expandcollapse popup#include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <Timers.au3> #include <Date.au3> #include <ProgressConstants.au3> Global $iCountdown = 6; Sets the time-out in seconds $iTotal_Time = 5 $Prompt = 0 $Form1 = GUICreate("Remaining Time To Continue", 415, 145, -1, -1, BitOR($WS_CAPTION, $WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS), $WS_EX_WINDOWEDGE); Creates GUI Window $Progress = GUICtrlCreateProgress(10, 65, 395, 15, $PBS_SMOOTH); Creates Progress Bar GUICtrlSetColor($Progress, 0xff0000); Sets Progress Bar Color $Label1 = GUICtrlCreateLabel("", 10, 10, 405, 25) GUISetState(@SW_SHOW) _Timer_SetTimer($Form1, 1000, '_Countdown') While 1 $nMsg = GUIGetMsg() WEnd ;-------------Functions Below this Line--------------------------- Func _Countdown($hWnd, $iMsg, $iIDTimer, $dwTime) $iCountdown -= 1 $percent_value = (($iCountdown / $iTotal_Time) * 100) If $iCountdown > 0 Then GUICtrlSetData($Label1, $Prompt & _SecsToTime($iCountdown) & " Time Remaining to Continue") GUICtrlSetData($Progress, $percent_value) ElseIf $percent_value <= 0 Then GUICtrlSetData($Label1, $Prompt & _SecsToTime($iCountdown) & " Time Remaining to Continue") GUICtrlSetData($Progress, $percent_value) Exit EndIf EndFunc;==>_Countdown Func _SecsToTime($iSecs) Local $iHours, $iMins, $iSec_s _TicksToTime($iSecs*1000,$iHours,$iMins,$iSec_s) Return StringFormat("%01i:%02i",$iMins, $iSec_s) EndFunc I have not succeded to call it from my script. I do not want to mess it up with my script, i just wanna use in my script #include<name_of_above_code.au3> and then somehow to call it. Thank you in advance for your support !
Juvigy Posted May 8, 2009 Posted May 8, 2009 So ? Make it a Function and call it whenever you want with the function name...
mentosan Posted May 8, 2009 Author Posted May 8, 2009 Can you detail how to create a function if it's an external file ?
Juvigy Posted May 8, 2009 Posted May 8, 2009 Copy bellow to your script expandcollapse popup#include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <Timers.au3> #include <Date.au3> #include <ProgressConstants.au3> Global $iCountdown = 6; Sets the time-out in seconds ;Call the function Whatever() Func Whatever() $iTotal_Time = 5 $Prompt = 0 $Form1 = GUICreate("Remaining Time To Continue", 415, 145, -1, -1, BitOR($WS_CAPTION, $WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS), $WS_EX_WINDOWEDGE); Creates GUI Window $Progress = GUICtrlCreateProgress(10, 65, 395, 15, $PBS_SMOOTH); Creates Progress Bar GUICtrlSetColor($Progress, 0xff0000); Sets Progress Bar Color $Label1 = GUICtrlCreateLabel("", 10, 10, 405, 25) GUISetState(@SW_SHOW) _Timer_SetTimer($Form1, 1000, '_Countdown') While 1 $nMsg = GUIGetMsg() WEnd End func ;-------------Functions Below this Line--------------------------- Func _Countdown($hWnd, $iMsg, $iIDTimer, $dwTime) $iCountdown -= 1 $percent_value = (($iCountdown / $iTotal_Time) * 100) If $iCountdown > 0 Then GUICtrlSetData($Label1, $Prompt & _SecsToTime($iCountdown) & " Time Remaining to Continue") GUICtrlSetData($Progress, $percent_value) ElseIf $percent_value <= 0 Then GUICtrlSetData($Label1, $Prompt & _SecsToTime($iCountdown) & " Time Remaining to Continue") GUICtrlSetData($Progress, $percent_value) Exit EndIf EndFunc;==>_Countdown Func _SecsToTime($iSecs) Local $iHours, $iMins, $iSec_s _TicksToTime($iSecs*1000,$iHours,$iMins,$iSec_s) Return StringFormat("%01i:%02i",$iMins, $iSec_s) EndFunc
mentosan Posted May 8, 2009 Author Posted May 8, 2009 AAh, I see now. You did opposite as I expected. You have included in this code my script. I was thinking viceversa to include in my script this code. Thanks anyway!
Juvigy Posted May 9, 2009 Posted May 9, 2009 I didnt get what you want exactly but lets say you have the code compiled to an .exe file. Whenever you want to include it/call it in your code just use : RunWait("C:\Exefile.exe)
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