GianAutoitprogrammer Posted April 16, 2011 Share Posted April 16, 2011 (edited) Hellow id just like to ask how to create a countdown timer in autoit I started with this code: It was the GUI of this program The timer has HH:MM:SS Hours/Minute/Seconds Countdown Timer #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=D:\Program Files\koda_1.7.3.0\Forms\timer.kxf $Form1 = GUICreate("Timer", 222, 119, 346, 191) $Label1 = GUICtrlCreateLabel("00", 0, 8, 40, 41) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel(":", 48, 8, 13, 41) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") $Label3 = GUICtrlCreateLabel("00", 72, 8, 40, 41) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") $Label4 = GUICtrlCreateLabel(":", 120, 8, 13, 41) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") $Label5 = GUICtrlCreateLabel("00", 136, 8, 40, 41) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("Start Countdown", 0, 64, 89, 33) $Button2 = GUICtrlCreateButton("Stop Countdown", 104, 64, 97, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $button1 ;countdown timer start Case $button2 ;countdown timer stop EndSwitch WEnd I dont use the Sleep() Function ... I need codes Edited April 16, 2011 by GianAutoitprogrammer Link to comment Share on other sites More sharing options...
wakillon Posted April 16, 2011 Share Posted April 16, 2011 An example : expandcollapse popup#include <WindowsConstants.au3> Global $SS_CENTER, $_CompteArebour = 60000, $_Minutes, $_Seconds $_GuiCountDown = GUICreate ( "CountDown...", 500, 200, @DesktopWidth/2 -250, @DesktopHeight/2 -100, $WS_EX_TOPMOST ) GUISetBkColor ( 0xFFFF00 ) $TimeLabel = GUICtrlCreateLabel ( "", 35, -10, 480, 180, $SS_CENTER ) GUICtrlSetFont ( -1, 125, 800 ) GUISetState ( ) WinSetOnTop ( $_GuiCountDown, "", 1 ) $TimeTicks = TimerInit ( ) While 1 _Check ( ) Sleep ( 200 ) WEnd Func _Check ( ) $_CompteArebour -= TimerDiff ( $TimeTicks ) $TimeTicks = TimerInit ( ) Local $_MinCalc = Int ( $_CompteArebour / ( 60 * 1000 ) ), $_SecCalc = $_CompteArebour - ( $_MinCalc * 60 * 1000 ) $_SecCalc = Int ( $_SecCalc / 1000 ) If $_MinCalc <= 0 And $_SecCalc <= 0 Then GUISetBkColor ( 0xFF0000, $_GuiCountDown ) GUICtrlSetData ( $TimeLabel, "Bye !" ) Sleep ( 1000 ) ; If @Compiled Then Shutdown ( 13 ) Exit Else If $_MinCalc <> $_Minutes Or $_SecCalc <> $_Seconds Then $_Minutes = $_MinCalc $_Seconds = $_SecCalc GUICtrlSetData ( $TimeLabel, StringFormat ( "%02u" & ":" & "%02u", $_Minutes, $_Seconds ) ) If $_Minutes = 0 And $_Seconds <= 10 Then Beep ( 1200, 100 ) GUISetBkColor ( 0xA093FF, $_GuiCountDown ) EndIf EndIf EndIf EndFunc ;==> _Check ( ) balgur 1 AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
GianAutoitprogrammer Posted April 16, 2011 Author Share Posted April 16, 2011 thank You Link to comment Share on other sites More sharing options...
wakillon Posted April 16, 2011 Share Posted April 16, 2011 thank You Is it as you like ? AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
GianAutoitprogrammer Posted April 16, 2011 Author Share Posted April 16, 2011 hey wakillon, the script that you posted doesnt have hours the script only has Minutes and seconds... Link to comment Share on other sites More sharing options...
GianAutoitprogrammer Posted April 16, 2011 Author Share Posted April 16, 2011 I need a timer HH:MM:SS Hours:Minutes:Seconds I am going to build a client timer software for computer shops I mean a cafeagent like software... using autoit... Link to comment Share on other sites More sharing options...
Developers Jos Posted April 16, 2011 Developers Share Posted April 16, 2011 Try understanding the script and it should be easy to adapt. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 16, 2011 Moderators Share Posted April 16, 2011 GianAutoitprogrammer,So far you have been "GianAutoitASKER" - this forum is not a request shop for everything you want in AutoIt. We expect YOU to do some of the work yourself. wakillon has very kindly given you a a good chunk of code (as have others in other threads, including myself) - it is now up to YOU to develop those snippets. We are here to help you when you run into problems, but we are NOT here to write your code for you.I would suggest you take a little time to learn a bit about AutoIt. Reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should also look at the excellent tutorials that you will find here and here - you will find other tutorials in the Wiki (the link is at the top of the page). There are even video tutorials on YouTube if you prefer watching to reading.So over to you. Start writing your own scripts and you will find us ready and willing to help - keep asking for code and you will soon find that no-one will answer.Your choice! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
GianAutoitprogrammer Posted April 16, 2011 Author Share Posted April 16, 2011 @jos which script wakillon script? Link to comment Share on other sites More sharing options...
GianAutoitprogrammer Posted April 16, 2011 Author Share Posted April 16, 2011 @Melba23 I am helphing others since yesterday iam viewing the Genral help and Support and searching for the problems that I can solve... Sorry if I am asking too much I am just in a hurry... Link to comment Share on other sites More sharing options...
wakillon Posted April 16, 2011 Share Posted April 16, 2011 @Melba23 I am helphing others since yesterday iam viewing the Genral help and Support and searching for the problems that I can solve... Sorry if I am asking too much I am just in a hurry...Allez au boulot !Show us your adaptation of my countdown ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
GianAutoitprogrammer Posted April 16, 2011 Author Share Posted April 16, 2011 @Melba23 I am using autoit since last year but there are some funcrions that I cant understand so thats why I am asking here... But its okay, i am asking too much... Link to comment Share on other sites More sharing options...
GianAutoitprogrammer Posted April 16, 2011 Author Share Posted April 16, 2011 and who knows I am just a second year high school... Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 16, 2011 Share Posted April 16, 2011 Search the 'Example Scripts' forum section using 'countdown' as the keyword.. - 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...
GianAutoitprogrammer Posted April 16, 2011 Author Share Posted April 16, 2011 @somdcomputerguy I am now searching... Link to comment Share on other sites More sharing options...
GianAutoitprogrammer Posted April 16, 2011 Author Share Posted April 16, 2011 Okay I think I cant create a countdown timer but I can call the sleep() function Sleep(3600) ; 3600 ms = 1 hr 1hr countdown timer ... Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 16, 2011 Share Posted April 16, 2011 Good step. Read thru all the scripts you find. So while Jos was refering to the code that wakillon posted in this thread to help you, it will surely help you to read thru the many 'countdown' related scripts you will find in the Examples section. Soon the lightbulb above your head will be burning brightly! - 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...
somdcomputerguy Posted April 16, 2011 Share Posted April 16, 2011 (edited) Read thru the Help file too. Sleep(3600) will 'sleep' for slightly more than 3 and half seconds..They don't teach milliseconds until junior (3rd) year in your high school?<br> Edited April 16, 2011 by somdcomputerguy - 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...
GianAutoitprogrammer Posted April 16, 2011 Author Share Posted April 16, 2011 tnx all of you for helping me Link to comment Share on other sites More sharing options...
UEZ Posted April 16, 2011 Share Posted April 16, 2011 (edited) Have a look here: Br, UEZ Edited April 16, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ 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