BadBoyDeGekste Posted March 3, 2008 Share Posted March 3, 2008 Func GoToBathroom() $afksleep = Random(60000, 150000, 1) _TicksToTime($afksleep, $iHours, $iMins, $iSecs) ToolTip("Going to the bathroom for " & $iHours & ":" & $iMins & ":" & $iSecs, 0, 0) Sleep($afksleep) ToolTip("") EndFunc can anyone help with making it count down till 0 ? thanks in advance, Eric Link to comment Share on other sites More sharing options...
igotandrew Posted March 3, 2008 Share Posted March 3, 2008 Count down to 0? Sounds like a for..next loop to me. Link to comment Share on other sites More sharing options...
martin Posted March 4, 2008 Share Posted March 4, 2008 Func GoToBathroom() $afksleep = Random(60000, 150000, 1) _TicksToTime($afksleep, $iHours, $iMins, $iSecs) ToolTip("Going to the bathroom for " & $iHours & ":" & $iMins & ":" & $iSecs, 0, 0) Sleep($afksleep) ToolTip("") EndFunc can anyone help with making it count down till 0 ? thanks in advance, Eric #include <date.au3> Global $afksleep, $lasth, $lastm, $lasts $begin = Random(600000, 1500000, 1) $afksleep = $begin $start = TimerInit() While $afksleep > 0 $afksleep = $begin - TimerDiff($start) GoToBathroom() Sleep(1000) WEnd ToolTip("") Func GoToBathroom() Local $iHours, $iMins, $iSecs _TicksToTime($afksleep, $iHours, $iMins, $iSecs) If $lasth <> $iHours Or $lastm <> $iMins Or $lasts <> $iSecs Then ToolTip("Going to the bathroom for " & $iHours & ":" & $iMins & ":" & $iSecs, 0, 0) $lasth = $iHours $lastm = $iMins $lasts = $iSecs EndIf EndFunc ;==>GoToBathroom Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
igotandrew Posted March 4, 2008 Share Posted March 4, 2008 Or you can use a while...wend loop Thanks Martin for the code. So if I'm not mistaken you can/should use this for a timer? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 4, 2008 Moderators Share Posted March 4, 2008 (edited) expandcollapse popupGlobal $bBreak, $nMinTime = 60000, $nMaxTime = 150000 HotKeySet("{HOME}", "_BathroomBreak") HotKeySet("{END}", "_ExitScript") While 1 Sleep(3000) WEnd Func _BathroomBreak() If $bBreak Then Return $bBreak = Not $bBreak Local $sStartTime = @HOUR & ":" & @MIN & ":" & @SEC Local $sEndTime = "00:00:" & Int(Random($nMinTime, $nMaxTime, 1) / 1000) Local $sTimeBack = _StrAddSub($sStartTime, $sEndTime, 0) Local $sDiffTime , $sSubTime, $sSubTimeDiff While $bBreak And $sDiffTime <> $sTimeBack $sSubTime = _StrAddSub(@HOUR & ":" & @MIN & ":" & @SEC, $sStartTime, 0) $sDiffTime = _StrAddSub($sStartTime, $sSubTime, 0) $sSubTimeDiff = _StrAddSub($sTimeBack, $sDiffTime, 0) ToolTip("Time back at: " & $sTimeBack & @CRLF & _ "Count down: " & $sSubTimeDiff & @CRLF & _ "Going to the bathroom for " & $sDiffTime, 0, 0) Sleep(1000) WEnd ToolTip("") $bBreak = False Return EndFunc Func _StrAddSub($sTime1, $sTime2, $iAdd = 1, $sDelim = ':'); $iAdd = 1 Add, $iAdd = 0 Subtract Local $aSplit1 = StringSplit($sTime1, $sDelim), $iSubTotal = 0 Local $aSplit2 = StringSplit($sTime2, $sDelim) If $aSplit1[0] <> 3 Or $aSplit2[0] <> 3 Then Return SetError(0, 0, 0) Local $iTotal1 = ((Int($aSplit1[1]) * 3600) + (Int($aSplit1[2]) * 60) + (Int($aSplit1[3]))) Local $iTotal2 = ((Int($aSplit2[1]) * 3600) + (Int($aSplit2[2]) * 60) + (Int($aSplit2[3]))) If $iAdd Then $iSubTotal = $iTotal1 + $iTotal2 ElseIf $iTotal1 >= $iTotal2 Then $iSubTotal = $iTotal1 - $iTotal2 Else $iSubTotal = $iTotal2 - $iTotal1 EndIf Local $iHour = Int(($iSubTotal / 3600)) Local $iMin = Int(($iSubTotal - ($iHour * 3600)) / 60) Local $iSec = Int(($iSubTotal - $iHour * 3600) - ($iMin * 60)) Return StringFormat('%02d', $iHour) & $sDelim & StringFormat('%02d', $iMin) & $sDelim & StringFormat('%02d', $iSec) EndFunc Func _ExitScript() Exit 1 EndFuncA bit more technical if you really want to get down and dirty Edited March 4, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
igotandrew Posted March 4, 2008 Share Posted March 4, 2008 Geeze overcode Isn't some of this code unneeded? Anyways, Thanks time to study. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 4, 2008 Moderators Share Posted March 4, 2008 (edited) Geeze overcode Isn't some of this code unneeded?Anyways, Thanks time to study.Why would you ask that question? What part of it do you see that is "un-needed"?I ask the above, because I don't know what the OP wants to do with the timer func, so why not give the OP all the options that could be possible?Overkill... as I said... No, because I was just trying to cover all bases. Edited March 4, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
igotandrew Posted March 4, 2008 Share Posted March 4, 2008 Why would you ask that question? What part of it do you see that is "un-needed"?I ask the above, because I don't know what the OP wants to do with the timer func, so why not give the OP all the options that could be possible?Overkill... as I said... No, because I was just trying to cover all bases.Not trying to get in a heated debate.. but countdown to 0..meaning subtract?Anyways thanks for the code. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 4, 2008 Moderators Share Posted March 4, 2008 Not trying to get in a heated debate.. but countdown to 0..meaning subtract?Anyways thanks for the code.I wasn't debating (you'll know when I am ), in fact... You're "opinion" isn't even an issue here since it's not your post... and I was responding (not like me mind you) to a PM that the original poster sent me but wasn't descriptive enough on what they actually intended their function to do. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
igotandrew Posted March 4, 2008 Share Posted March 4, 2008 You win.Thanks for the code, once again. Link to comment Share on other sites More sharing options...
Mattraks Posted March 4, 2008 Share Posted March 4, 2008 I wasn't debating (you'll know when I am ), in fact... You're "opinion" isn't even an issue here since it's not your post... and I was responding (not like me mind you) to a PM that the original poster sent me but wasn't descriptive enough on what they actually intended their function to do.Thats not really correct English now is it? You're = You are and that doesn't really fit what you were saying You should have put Your meaning his/hers and then it would be correct Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 4, 2008 Moderators Share Posted March 4, 2008 Thats not really correct English now is it? You're = You are and that doesn't really fit what you were saying You should have put Your meaning his/hers and then it would be correct Thanks, high school has been over for me for many years... I don't usually go through my posts with a fine tooth comb to see if I've dotted all my "i"'s and crossed all my "t"'s.The fact that you understood what I meant is good enough for me.P.S. (did I do that right?)I think this/these type of forum(s) may be suited for you http://www.englishforums.com/English/ and your type of expertise. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Mattraks Posted March 4, 2008 Share Posted March 4, 2008 Thanks, high school has been over for me for many years... I don't usually go through my posts with a fine tooth comb to see if I've dotted all my "i"'s and crossed all my "t"'s.The fact that you understood what I meant is good enough for me.P.S. (did I do that right?)I think this/these type of forum(s) may be suited for you http://www.englishforums.com/English/ and your type of expertise.Although I do want to become a High School English teacher when I grow up, that forum seems like its for people that have no idea how to type English. I also doubt that they would accept someone in Middle School to be a teacher there... Link to comment Share on other sites More sharing options...
Paulie Posted March 4, 2008 Share Posted March 4, 2008 (edited) Thats not really correct English now is it? You're = You are and that doesn't really fit what you were saying You should have put Your meaning his/hers and then it would be correct Well, if we are going to pick apart posts for grammatical errors, let's not exempt you from the same scrutiny. In that post alone, which is ironically enough criticizing someone else, you have made several errors yourself: You neglected the apostrophe in the word "That's."Your use of the word "now" implies that the mistake would be correct at some other time, but regardless, it should at least have been followed by a comma.You forgot quotations around all of the words that you used out of context. The "y" in "You are" should not be capitalized, and neither should the "y" in "Your" in the line below. You used an "=" when you were not referencing to a mathematical equation.You have no punctuation on the ends of any of your sentences, with the exception of one question mark.It should have been written like this:That's not truly correct English, is it? The word "you're" means "you are" and that doesn't fit what you were saying. You should have used "your" meaning "his or hers." Then it would have been correct. Let's not be hypocritical. *Waiting for someone to pick apart my grammar* EDIT: corrected grammatical error Edited March 4, 2008 by Paulie Link to comment Share on other sites More sharing options...
BadBoyDeGekste Posted March 4, 2008 Author Share Posted March 4, 2008 expandcollapse popupGlobal $bBreak, $nMinTime = 60000, $nMaxTime = 150000 HotKeySet("{HOME}", "_BathroomBreak") HotKeySet("{END}", "_ExitScript") While 1 Sleep(3000) WEnd Func _BathroomBreak() If $bBreak Then Return $bBreak = Not $bBreak Local $sStartTime = @HOUR & ":" & @MIN & ":" & @SEC Local $sEndTime = "00:00:" & Int(Random($nMinTime, $nMaxTime, 1) / 1000) Local $sTimeBack = _StrAddSub($sStartTime, $sEndTime, 0) Local $sDiffTime , $sSubTime, $sSubTimeDiff While $bBreak And $sDiffTime <> $sTimeBack $sSubTime = _StrAddSub(@HOUR & ":" & @MIN & ":" & @SEC, $sStartTime, 0) $sDiffTime = _StrAddSub($sStartTime, $sSubTime, 0) $sSubTimeDiff = _StrAddSub($sTimeBack, $sDiffTime, 0) ToolTip("Time back at: " & $sTimeBack & @CRLF & _ "Count down: " & $sSubTimeDiff & @CRLF & _ "Going to the bathroom for " & $sDiffTime, 0, 0) Sleep(1000) WEnd ToolTip("") $bBreak = False Return EndFunc Func _StrAddSub($sTime1, $sTime2, $iAdd = 1, $sDelim = ':'); $iAdd = 1 Add, $iAdd = 0 Subtract Local $aSplit1 = StringSplit($sTime1, $sDelim), $iSubTotal = 0 Local $aSplit2 = StringSplit($sTime2, $sDelim) If $aSplit1[0] <> 3 Or $aSplit2[0] <> 3 Then Return SetError(0, 0, 0) Local $iTotal1 = ((Int($aSplit1[1]) * 3600) + (Int($aSplit1[2]) * 60) + (Int($aSplit1[3]))) Local $iTotal2 = ((Int($aSplit2[1]) * 3600) + (Int($aSplit2[2]) * 60) + (Int($aSplit2[3]))) If $iAdd Then $iSubTotal = $iTotal1 + $iTotal2 ElseIf $iTotal1 >= $iTotal2 Then $iSubTotal = $iTotal1 - $iTotal2 Else $iSubTotal = $iTotal2 - $iTotal1 EndIf Local $iHour = Int(($iSubTotal / 3600)) Local $iMin = Int(($iSubTotal - ($iHour * 3600)) / 60) Local $iSec = Int(($iSubTotal - $iHour * 3600) - ($iMin * 60)) Return StringFormat('%02d', $iHour) & $sDelim & StringFormat('%02d', $iMin) & $sDelim & StringFormat('%02d', $iSec) EndFunc Func _ExitScript() Exit 1 EndFuncA bit more technical if you really want to get down and dirty its exactly what I need but it has some flaws time back at: gives the time - the countdown while it should be added count down works but Going to the Bathroom for gives the current time and it also counts down, so when "Count Down" reaches 00:00:00 it starts to go up again and your script is way out of my league to understand I'll try it but maybe someone can help me? Greetings, Eric Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 4, 2008 Moderators Share Posted March 4, 2008 (edited) expandcollapse popupGlobal $bBreak, $nMinTime = 60000, $nMaxTime = 150000 HotKeySet("{HOME}", "_BathroomBreak") HotKeySet("{END}", "_ExitScript") While 1 Sleep(3000) WEnd Func _BathroomBreak() If $bBreak Then Return $bBreak = Not $bBreak Local $sEndTime = "00:00:" & Int(Random($nMinTime, $nMaxTime, 1) / 1000) Local $sTimeBack = _StrAddSub(@HOUR & ":" & @MIN & ":" & @SEC, $sEndTime, 1) Local $sSubTimeDiff, $sHMS While $bBreak $sHMS = @HOUR & ":" & @MIN & ":" & @SEC $sSubTimeDiff = _StrAddSub($sTimeBack, $sHMS, 0) ToolTip("Time back at: " & $sTimeBack & @CRLF & _ "Be back in: " & $sSubTimeDiff & @CRLF & _ "Current Time: " & $sHMS, 0, 0) If $sHMS = $sTimeBack Then ExitLoop Sleep(1000) WEnd ToolTip("") $bBreak = False Return EndFunc Func _StrAddSub($sTime1, $sTime2, $iAdd = 1, $sDelim = ':'); $iAdd = 1 Add, $iAdd = 0 Subtract Local $aSplit1 = StringSplit($sTime1, $sDelim), $iSubTotal = 0 Local $aSplit2 = StringSplit($sTime2, $sDelim) If $aSplit1[0] <> 3 Or $aSplit2[0] <> 3 Then Return SetError(0, 0, 0) Local $iTotal1 = ((Int($aSplit1[1]) * 3600) + (Int($aSplit1[2]) * 60) + (Int($aSplit1[3]))) Local $iTotal2 = ((Int($aSplit2[1]) * 3600) + (Int($aSplit2[2]) * 60) + (Int($aSplit2[3]))) If $iAdd Then $iSubTotal = $iTotal1 + $iTotal2 ElseIf $iTotal1 >= $iTotal2 Then $iSubTotal = $iTotal1 - $iTotal2 Else $iSubTotal = $iTotal2 - $iTotal1 EndIf Local $iHour = Int(($iSubTotal / 3600)) Local $iMin = Int(($iSubTotal - ($iHour * 3600)) / 60) Local $iSec = Int(($iSubTotal - $iHour * 3600) - ($iMin * 60)) Return StringFormat('%02d', $iHour) & $sDelim & StringFormat('%02d', $iMin) & $sDelim & StringFormat('%02d', $iSec) EndFuncEdit: Removed unnecessary variables. Edited March 4, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 4, 2008 Moderators Share Posted March 4, 2008 I saw your PM, and can see where you might get lost. I'm not going to explain the _StrAddSub function I wrote, but I'll explain what I did for your needs specifically (this is another first, I don't usually comment my code )expandcollapse popupGlobal $bBreak, $nMinTime = 10000, $nMaxTime = 15000 ;Use the Home key on your keyboard to start the _BathroomBreak function HotKeySet("{HOME}", "_BathroomBreak") ;Use the End key on your keyboard to end the script completely HotKeySet("{END}", "_ExitScript") ;Even though we are not doing anything in this loop below, we still need it so we can use our Hotkeys While 1 Sleep(3000) WEnd Func _BathroomBreak() ;If this function is already in use, don't go any further If $bBreak Then Return ;If you are here, then this function is not currently being ran, now set $bBreak true so it doesn't get ran again until done $bBreak = Not $bBreak ;Set end time by using Random() Local $sEndTime = "00:00:" & Int(Random($nMinTime, $nMaxTime, 1) / 1000) ;Set time back, add current time to end time Local $sTimeBack = _StrAddSub(@HOUR & ":" & @MIN & ":" & @SEC, $sEndTime) Local $sSubTimeDiff, $sHMS ;The While loop, keep open until current time equals time to come back ;ie... If $sHMS = $sTimeBack Then ExitLoop ;Or, until $bBreak is no longer true (maybe set the condition in the _ExitScript Hotkey to $bBreak = Not $bBreak rather than Exit 1 While $bBreak ;Continue to get current time $sHMS = @HOUR & ":" & @MIN & ":" & @SEC ;Subtract current time from time back (3rd param of _StrAddSub set to zero = subtract time) $sSubTimeDiff = _StrAddSub($sTimeBack, $sHMS, 0) ToolTip("Time back at: " & $sTimeBack & @CRLF & _ "Be back in: " & $sSubTimeDiff & @CRLF & _ "Current Time: " & $sHMS, 0, 0) ;Explained above While $bBreak loop If $sHMS = $sTimeBack Then ExitLoop ;Since we are calculating in seconds, sleep 1 second at a time Sleep(1000) WEnd ToolTip("") ;Set the $bBreak to False (not being ran) so we can run again if we want. $bBreak = False Return EndFunc Func _StrAddSub($sTime1, $sTime2, $iAdd = 1, $sDelim = ':'); $iAdd = 1 Add, $iAdd = 0 Subtract Local $aSplit1 = StringSplit($sTime1, $sDelim), $iSubTotal = 0 Local $aSplit2 = StringSplit($sTime2, $sDelim) If $aSplit1[0] <> 3 Or $aSplit2[0] <> 3 Then Return SetError(0, 0, 0) Local $iTotal1 = ((Int($aSplit1[1]) * 3600) + (Int($aSplit1[2]) * 60) + (Int($aSplit1[3]))) Local $iTotal2 = ((Int($aSplit2[1]) * 3600) + (Int($aSplit2[2]) * 60) + (Int($aSplit2[3]))) If $iAdd Then $iSubTotal = $iTotal1 + $iTotal2 ElseIf $iTotal1 >= $iTotal2 Then $iSubTotal = $iTotal1 - $iTotal2 Else $iSubTotal = $iTotal2 - $iTotal1 EndIf Local $iHour = Int(($iSubTotal / 3600)) Local $iMin = Int(($iSubTotal - ($iHour * 3600)) / 60) Local $iSec = Int(($iSubTotal - $iHour * 3600) - ($iMin * 60)) Return StringFormat('%02d', $iHour) & $sDelim & StringFormat('%02d', $iMin) & $sDelim & StringFormat('%02d', $iSec) EndFunc Func _ExitScript() Exit 1 EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Xenobiologist Posted March 4, 2008 Share Posted March 4, 2008 Another one: #include<Date.au3> HotKeySet("{esc}", "end") ; "YYYY/MM/DD[ HH:MM:SS]" While 1 ToolTip("Date" & @CRLF & "============" & @CRLF & _counter("2008/03/21", "18:00:00") & " left", _ @DesktopWidth - 100, 30) Sleep(1) WEnd ; "YYYY/MM/DD[ HH:MM:SS]" Func _counter($s_Date, $s_time) If _DateIsValid($s_Date & " " & $s_time) Then Local $NumberOfSeconds = _DateDiff("s", _NowCalc(), $s_Date & " " & $s_time) Return StringFormat("Days = %.02d" & @CRLF & "Hours = %.02d" & @CRLF & "Min = %.02d" & @CRLF & "Sec = %.02d" & @CRLF & _ "Msec = %.03d", $NumberOfSeconds / 86400, Mod($NumberOfSeconds / 3600, 24), Mod(($NumberOfSeconds / 60), 60), _ Mod($NumberOfSeconds, 60), 1000 - _MSec()) Else Return -1 EndIf EndFunc ;==>_counter Func _MSec() Local $stSystemTime = DllStructCreate('ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort') DllCall('kernel32.dll', 'none', 'GetSystemTime', 'ptr', DllStructGetPtr($stSystemTime)) $sMilliSeconds = StringFormat('%03d', DllStructGetData($stSystemTime, 8)) $stSystemTime = 0 Return $sMilliSeconds EndFunc ;==>_MSec Func end() Exit (0) EndFunc ;==>end Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Rogue5099 Posted June 26, 2008 Share Posted June 26, 2008 I saw your PM, and can see where you might get lost. I'm not going to explain the _StrAddSub function I wrote, but I'll explain what I did for your needs specifically (this is another first, I don't usually comment my code )expandcollapse popupGlobal $bBreak, $nMinTime = 10000, $nMaxTime = 15000 ;Use the Home key on your keyboard to start the _BathroomBreak function HotKeySet("{HOME}", "_BathroomBreak") ;Use the End key on your keyboard to end the script completely HotKeySet("{END}", "_ExitScript") ;Even though we are not doing anything in this loop below, we still need it so we can use our Hotkeys While 1 Sleep(3000) WEnd Func _BathroomBreak() ;If this function is already in use, don't go any further If $bBreak Then Return ;If you are here, then this function is not currently being ran, now set $bBreak true so it doesn't get ran again until done $bBreak = Not $bBreak ;Set end time by using Random() Local $sEndTime = "00:00:" & Int(Random($nMinTime, $nMaxTime, 1) / 1000) ;Set time back, add current time to end time Local $sTimeBack = _StrAddSub(@HOUR & ":" & @MIN & ":" & @SEC, $sEndTime) Local $sSubTimeDiff, $sHMS ;The While loop, keep open until current time equals time to come back ;ie... If $sHMS = $sTimeBack Then ExitLoop ;Or, until $bBreak is no longer true (maybe set the condition in the _ExitScript Hotkey to $bBreak = Not $bBreak rather than Exit 1 While $bBreak ;Continue to get current time $sHMS = @HOUR & ":" & @MIN & ":" & @SEC ;Subtract current time from time back (3rd param of _StrAddSub set to zero = subtract time) $sSubTimeDiff = _StrAddSub($sTimeBack, $sHMS, 0) ToolTip("Time back at: " & $sTimeBack & @CRLF & _ "Be back in: " & $sSubTimeDiff & @CRLF & _ "Current Time: " & $sHMS, 0, 0) ;Explained above While $bBreak loop If $sHMS = $sTimeBack Then ExitLoop ;Since we are calculating in seconds, sleep 1 second at a time Sleep(1000) WEnd ToolTip("") ;Set the $bBreak to False (not being ran) so we can run again if we want. $bBreak = False Return EndFunc Func _StrAddSub($sTime1, $sTime2, $iAdd = 1, $sDelim = ':'); $iAdd = 1 Add, $iAdd = 0 Subtract Local $aSplit1 = StringSplit($sTime1, $sDelim), $iSubTotal = 0 Local $aSplit2 = StringSplit($sTime2, $sDelim) If $aSplit1[0] <> 3 Or $aSplit2[0] <> 3 Then Return SetError(0, 0, 0) Local $iTotal1 = ((Int($aSplit1[1]) * 3600) + (Int($aSplit1[2]) * 60) + (Int($aSplit1[3]))) Local $iTotal2 = ((Int($aSplit2[1]) * 3600) + (Int($aSplit2[2]) * 60) + (Int($aSplit2[3]))) If $iAdd Then $iSubTotal = $iTotal1 + $iTotal2 ElseIf $iTotal1 >= $iTotal2 Then $iSubTotal = $iTotal1 - $iTotal2 Else $iSubTotal = $iTotal2 - $iTotal1 EndIf Local $iHour = Int(($iSubTotal / 3600)) Local $iMin = Int(($iSubTotal - ($iHour * 3600)) / 60) Local $iSec = Int(($iSubTotal - $iHour * 3600) - ($iMin * 60)) Return StringFormat('%02d', $iHour) & $sDelim & StringFormat('%02d', $iMin) & $sDelim & StringFormat('%02d', $iSec) EndFunc Func _ExitScript() Exit 1 EndFunc If this goes from 11:59pm-12:00am it messes up reading it like this: Anyway to fix at this certain time frame? My projects: Inventory / Mp3 Inventory, Computer Stats Link to comment Share on other sites More sharing options...
Rogue5099 Posted June 26, 2008 Share Posted June 26, 2008 I found a solution to this by adding: Local $1 = (-1) Local $bTimeBack = StringTrimRight($sTimeBack, 6) If $bTimeBack >= 24 Then $sTimeBack = _StrAddSub($1 & ":" & @MIN & ":" & @SEC, $sEndTime)oÝ÷ Øíz¶®¶sdÆö6Âb33c·57V%FÖTFfbÂb33c·4Õ2âFRgVæ2&F&ööÒ'&V² Now the Be Back in is counting up till it changes from 11:59 pm to 12:00 am? My projects: Inventory / Mp3 Inventory, Computer Stats 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