GAM Posted March 19, 2008 Share Posted March 19, 2008 Hi, below is script written to display a message at 12:00AM everyday. Before displaying this message there appears a GUI with xyz message and also a button. Now, I want to include statements in the script such that on clicking this button another message should be displayed. Can anyone helo me out in this please???? -------------------------------------------------------- #include <GUIConstants.au3> #include <Date.au3> $Hours = "23" $Minutes = "59" $Seconds = "59" $FirstWarningAfter = "30" $FirstWarningBefore = "31" $SecondWarningAfter = "57" $SecondWarningBefore = "59" GUICreate("My GUI Progressbar",220,100, 100,200) GUICtrlSetColor(-1,32250) $Progressbar = GUICtrlCreateProgress (10,40,200,20,$PBS_SMOOTH) $ShutdownButton = GUICtrlCreateButton ("Dont Shutdown",75,70,100,20) While 1 $CurHours = @HOUR $CurMinutes = @MIN $CurSeconds = @SEC If ($CurHours = $Hours And $CurMinutes = $Minutes And $CurSeconds = $Seconds) Then MsgBox(0," ; ", "Its 00:00 AM") EndIf If $CurMinutes > $SecondWarningAfter Then If $CurMinutes <= $SecondWarningBefore Then For $i = $CurSeconds To 57 Step 1 GUISetState () GUICtrlSetData ($Progressbar, (60-$i)) Sleep(1000) Next GUIDelete() EndIf EndIf Sleep(50) WEnd Neil Link to comment Share on other sites More sharing options...
BrettF Posted March 19, 2008 Share Posted March 19, 2008 If you're using a Select...Case Loop (which I see you are not. (tags make it easy to read), just use $msg = $btn, where $msg = GUIGetMsg (). Then you even goes after. 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! Link to comment Share on other sites More sharing options...
Greenhorn Posted March 19, 2008 Share Posted March 19, 2008 (edited) Moin Moin, try this and rebuild it in your way ... expandcollapse popup#include <GUIConstants.au3> #include <Date.au3> $Hours = 23 $Minutes = 59 $Seconds = 59 $FirstWarningAfter = 30 $FirstWarningBefore = 31 $SecondWarningAfter = 57 $SecondWarningBefore = 59 Global $iTime = $Hours & $Minutes & $Seconds $hWnd = GUICreate("My GUI Progressbar",220,100, 100,200) GUICtrlSetColor(-1,32250) $Progressbar = GUICtrlCreateProgress (10,40,200,20,$PBS_SMOOTH) $ShutdownButton = GUICtrlCreateButton ("Dont Shutdown",75,70,100,20) ;GUISetState() While True Switch GUIGetMsg() Case -3 Exit Case $ShutdownButton MsgBox(4096, 'Message', 'Button is pressed ...') ;;; go on here ... EndSwitch ; call your Function Time() WEnd Func Time() ; Local $CurHours = @HOUR ; Local $CurMinutes = @MIN Local $CurSeconds = @SEC Local $iCurrentTime = @HOUR & @MIN & @SEC ; If ($CurHours = $Hours And $CurMinutes = $Minutes And $CurSeconds = $Seconds) Then If $iTime == $iCurrentTime Then MsgBox(0," ; ", "Its 00:00 AM") EndIf If @MIN > $SecondWarningAfter Then If @MIN <= $SecondWarningBefore Then GUISetState (@SW_SHOW) ; show the GUI before the loop begins For $i = $CurSeconds To 57 Step 1 GUICtrlSetData ($Progressbar, (60-$i)) Sleep(1000) Next GUISetState (@SW_HIDE) ; hide the GUI if you want to display it again ; GUIDelete() EndIf EndIf Sleep(50) EndFunc Greetz Greenhorn Edited March 19, 2008 by Greenhorn 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