riceking Posted July 30, 2010 Share Posted July 30, 2010 (edited) I have a script that runs once per hour. Its similar to: While 1 Sleep(360000) WinActivate("NotePad") Send("Loged 1 hour") Send("{TAB}") WEnd I'm going to make a GUI soon and on that GUI I want it to display how much time left until the script resumes again, so basically a countdown on Sleep(360000), what would I use to display the time left as well. Thanks~ Edited July 30, 2010 by riceking \ Link to comment Share on other sites More sharing options...
somdcomputerguy Posted July 30, 2010 Share Posted July 30, 2010 Maybe something like this? This is a stripped down copy of a project I got going.. expandcollapse popup#include <Constants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Opt('MustDeclareVars', 1) Global $Countdown, $CountdownTotal Local $Form, $Label1, $Label4, $Input1, $Button1, $Progressbar1 #Region ### START Koda GUI section ### $Form = GUICreate("", 420, 150, 25, @DesktopHeight - 235) $Label1 = GUICtrlCreateLabel("Seconds", 10, 16, 55, 17) $Label4 = GUICtrlCreateLabel("** Label **", 95, 95, 250, 20) $Input1 = GUICtrlCreateInput("90", 70, 15, 40, 20) $Button1 = GUICtrlCreateButton("Start", 275, 115, 50, 23, $WS_GROUP) GUICtrlSetState($Button1, $GUI_FOCUS) GUICtrlSetOnEvent($Button1, "Start") $Progressbar1 = GUICtrlCreateProgress(95, 120, 150, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(10) WEnd Func Start() While 1 GUICtrlSetData($Label4, "Checking the page..") $Countdown = GUICtrlRead($Input1) * 1000 $CountdownTotal = $Countdown Do If $Countdown / 1000 = 1 Then GUICtrlSetData($Label4, "Waiting.. " & $Countdown / 1000 & " second") Else GUICtrlSetData($Label4, "Waiting.. " & $Countdown / 1000 & " seconds") EndIf GUICtrlSetData($Progressbar1, ($Countdown / $CountdownTotal) * 100) Sleep(1000) $Countdown = $Countdown - 1000 Until $Countdown <= 0 WEnd EndFunc ;==>Start - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. 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