russell Posted September 28, 2011 Posted September 28, 2011 So using samples i was able to modify and make a code i needed, however it only counts down from 1 min. I need it to count down from 1 hour. I know that the problem is in the bottom, when i set that if the vaule is < 0 to =0 but if i dont have this it start counting in the negatives. I cant seem to find a way around this to start at 60min each time the number is pressed. Can anyone see a way? expandcollapse popup#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("AForm1", 122, 110, 438, 156) $Label1 = GUICtrlCreateLabel("60:00", 8, 8, 43, 17) $Label2 = GUICtrlCreateLabel("60:00", 8, 20, 66, 17) $Label3 = GUICtrlCreateLabel("60:00", 8, 32, 66, 17) $Label4 = GUICtrlCreateLabel("60:00", 8, 44, 66, 17) $Label5 = GUICtrlCreateLabel("60:00", 8, 56, 66, 17) $Label6 = GUICtrlCreateLabel("60:00", 8, 68, 66, 17) $Label7 = GUICtrlCreateLabel("60:00", 8, 80, 66, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $startmins = 60 ;in mins $time= 0 $time2 = 0 $time3 = 0 $time4 = 0 $time5 = 0 $time6 = 0 $time7 = 0 HotKeySet("{1}", "rest1") Func rest1() $time=TimerInit() EndFunc HotKeySet("{2}", "rest2") Func rest2() $time2=TimerInit() EndFunc HotKeySet("{3}", "rest3") Func rest3() $time3=TimerInit() EndFunc HotKeySet("{4}", "rest4") Func rest4() $time4=TimerInit() EndFunc HotKeySet("{5}", "rest5") Func rest5() $time5=TimerInit() EndFunc HotKeySet("{6}", "rest6") Func rest6() $time6=TimerInit() EndFunc HotKeySet("{7}", "rest7") Func rest7() $time7=TimerInit() EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch ;~ -------------------------------- $new = TimerDiff ($time) $new2 = TimerDiff ($time2) $new3 = TimerDiff ($time3) $new4 = TimerDiff ($time4) $new5 = TimerDiff ($time5) $new6 = TimerDiff ($time6) $new7 = TimerDiff ($time7) ;~ ------------------------------ $new = ($startmins*60*1000)-$new $new2 = ($startmins*60*1000)-$new2 $new3 = ($startmins*60*1000)-$new3 $new4 = ($startmins*60*1000)-$new4 $new5 = ($startmins*60*1000)-$new5 $new6 = ($startmins*60*1000)-$new6 $new7 = ($startmins*60*1000)-$new7 ;~ ---------------------------------- $seconds = Round ($new/1000) $seconds2 = Round ($new2/1000) $seconds3 = Round ($new3/1000) $seconds4 = Round ($new4/1000) $seconds5 = Round ($new5/1000) $seconds6 = Round ($new6/1000) $seconds7 = Round ($new7/1000) ;~ ------------------------------------- $newMin = Floor ($seconds/60) $newMin2 = Floor ($seconds2/60) $newMin3 = Floor ($seconds3/60) $newMin4 = Floor ($seconds4/60) $newMin5 = Floor ($seconds5/60) $newMin6 = Floor ($seconds6/60) $newMin7 = Floor ($seconds7/60) ;~ ------------------------------------ $newSec = Mod ($seconds, 60) $newSec2 = Mod ($seconds2, 60) $newSec3 = Mod ($seconds3, 60) $newSec4 = Mod ($seconds4, 60) $newSec5 = Mod ($seconds5, 60) $newSec6 = Mod ($seconds6, 60) $newSec7 = Mod ($seconds7, 60) ;~ ------------------------------------ If $newSec < 10 Then $newSec = "0"&$newSec GUICtrlSetData ($Label1, $newMin&":"&$newSec) If $newSec2 < 10 Then $newSec2 = "0"&$newSec2 GUICtrlSetData ($Label2, $newMin2&":"&$newSec2) If $newSec3 < 10 Then $newSec3 = "0"&$newSec3 GUICtrlSetData ($Label3, $newMin3&":"&$newSec3) If $newSec4 < 10 Then $newSec4 = "0"&$newSec4 GUICtrlSetData ($Label4, $newMin4&":"&$newSec4) If $newSec5 < 10 Then $newSec5 = "0"&$newSec5 GUICtrlSetData ($Label5, $newMin5&":"&$newSec5) If $newSec6 < 10 Then $newSec6 = "0"&$newSec6 GUICtrlSetData ($Label6, $newMin6&":"&$newSec6) If $newSec7 < 10 Then $newSec7 = "0"&$newSec7 GUICtrlSetData ($Label7, $newMin7&":"&$newSec7) ;------------------------------------------------------------- If $newSec+$newMin < 0 Then $newSec =0 $newMin =0 GUICtrlSetData ($Label1, $newMin&":"&$newSec) If $newSec2+$newMin2 < 0 Then $newSec2 =0 $newMin2 =0 GUICtrlSetData ($Label2, $newMin2&":"&$newSec2) If $newSec3+$newMin3 < 0 Then $newSec3 =0 $newMin3 =0 GUICtrlSetData ($Label3, $newMin3&":"&$newSec3) If $newSec4+$newMin4 < 0 Then $newSec4 =0 $newMin4 =0 GUICtrlSetData ($Label4, $newMin4&":"&$newSec4) If $newSec5+$newMin5 < 0 Then $newSec5 =0 $newMin5 =0 GUICtrlSetData ($Label5, $newMin5&":"&$newSec5) If $newSec6+$newMin6 < 0 Then $newSec6 =0 $newMin6 =0 GUICtrlSetData ($Label6, $newMin6&":"&$newSec6) If $newSec7+$newMin7 < 0 Then $newSec7 =0 $newMin7 =0 GUICtrlSetData ($Label7, $newMin7&":"&$newSec7) Sleep (1000) WEnd muppet hands are so soft :)
russell Posted September 29, 2011 Author Posted September 29, 2011 Solution was $newMin = Floor ($seconds/60) if $newMin < 0 then $newmin = "Tray " $newMin2 = Floor ($seconds2/60) if $newMin2 < 0 then $newmin2 = "Tray " $newMin3 = Floor ($seconds3/60) if $newMin3 < 0 then $newmin3 = "Tray " $newMin4 = Floor ($seconds4/60) if $newMin4 < 0 then $newmin4 = "Tray " $newMin5 = Floor ($seconds5/60) if $newMin5 < 0 then $newmin5 = "Tray " $newMin6 = Floor ($seconds6/60) if $newMin6 < 0 then $newmin6 = "Tray " $newMin7 = Floor ($seconds7/60) if $newMin7 < 0 then $newmin7 = "Tray " and change the bottom to If $newSec+$newMin < 0 Then $newSec =0 GUICtrlSetData ($Label1, $newMin&":"&$newSec) If $newSec2+$newMin2 < 0 Then $newSec2 =0 GUICtrlSetData ($Label2, $newMin2&":"&$newSec2) If $newSec3+$newMin3 < 0 Then $newSec3 =0 GUICtrlSetData ($Label3, $newMin3&":"&$newSec3) If $newSec4+$newMin4 < 0 Then $newSec4 =0 GUICtrlSetData ($Label4, $newMin4&":"&$newSec4) If $newSec5+$newMin5 < 0 Then $newSec5 =0 GUICtrlSetData ($Label5, $newMin5&":"&$newSec5) If $newSec6+$newMin6 < 0 Then $newSec6 =0 GUICtrlSetData ($Label6, $newMin6&":"&$newSec6) If $newSec7+$newMin7 < 0 Then $newSec7 =0 GUICtrlSetData ($Label7, $newMin7&":"&$newSec7) muppet hands are so soft :)
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