Legacy1 Posted October 20, 2009 Share Posted October 20, 2009 (edited) Ok, so here's my code: HotKeySet("{F7}", "Time") HotKeySet("{F8}", "Start") HotKeySet("{F9}", "Exitt") While 1 Sleep(100) WEnd Func Time() Global $Data = InputBox("Timer","Enter the time you want to be timed, in seconds. F8 to Start.",""," M",60,140) MsgBox(0,"Timer", $Data&" seconds?") EndFunc Func Start() ProgressOn("Progress Meter", "Timer", "0 percent") For $i = 0 to 100 step 100/$Data sleep(1000) ProgressSet( $i, $i & " percent") Next ProgressSet(100 , "DING!", "Complete") Beep(500,1000) Beep(1500,1000) Beep(1000,1000) Beep(500,1000) sleep(500) ProgressOff() EndFunc Func Exitt() Exit EndFunc What I want to do, instead of just having, ie '100 seconds' have '1 min 40 sec'. I thought I would have to do something like, if $Data <60 = /60, maybe? Do I need another func for this? Edited October 20, 2009 by Legacy1 Link to comment Share on other sites More sharing options...
Authenticity Posted October 20, 2009 Share Posted October 20, 2009 Linkfunction SecToTime(Sec: Integer): string; var H, M, S: string; ZH, ZM, ZS: Integer; begin ZH := Sec div 3600; ZM := Sec div 60 - ZH * 60; ZS := Sec - (ZH * 3600 + ZM * 60) ; H := IntToStr(ZH) ; M := IntToStr(ZM) ; S := IntToStr(ZS) ; Result := H + ':' + M + ':' + S; end;So in AutoIt it'd be:Func _SecToTime($Sec) Local $H, $M, $S $H = Int($Sec/3600) $M = Int($Sec/60-$H*60) $S = Int($Sec-($H*3600+$M*60)) Return $H & ':' & $M & ':' & $S EbdFunc Link to comment Share on other sites More sharing options...
Legacy1 Posted October 20, 2009 Author Share Posted October 20, 2009 Yay ^^ New code. expandcollapse popupDim $Sec = InputBox("Timer","Enter the time you want to be timed, in seconds. F8 to Start.",""," M",60,140) Dim $H = Int($Sec/3600) Dim $M = Int($Sec/60-$H*60) Dim $S = Int($Sec-($H*3600+$M*60)) Dim $Data = $H& ":" &$M& ":" &$S MsgBox(0,"Timer", $Data&" (Hours:Minutes:Seconds)") HotKeySet("{F7}", "Time") HotKeySet("{F8}", "Start") HotKeySet("{F9}", "Exitt") While 1 Sleep(100) WEnd Func Time() Global $Sec = InputBox("Timer","Enter the time you want to be timed, in seconds. F8 to Start.",""," M",60,140) MsgBox(0,"Timer", $Data&" (Hours:Minutes:Seconds)") EndFunc Func Start() Beep(2000,500) ProgressOn("Progress Meter", "Timer", "0 percent") For $i = 0 to 100 step 100/$Sec Sleep(1000) ProgressSet( $i, $i & " percent") Next ProgressSet(100 , "DING!", "Complete") Beep(500,1000) Beep(1500,1000) Beep(1000,1000) Beep(500,1000) sleep(500) ProgressOff() EndFunc Func Exitt() Exit EndFunc May be scruffy, but it works 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