Hey everybody, I'm having a problem with a counter script I'm creating. It's a counter that counts down a given time.
Now, it works OK, except for 1 small annoying thing. If a number gets below 10, it doesn't have a leading zero, which I would like. For example, a counter I would like for 10 minutes (and 0 hours):
00:00:00
What it gives me:
0:0:0
I've tried using an array search and paste a "0" as a string in front of it (after conversion) but to no avail... Any clues ? Here's my code so far.
$time_hrs = Int(ControlGetText("","",$hrs))
$time_min = Int(ControlGetText("","",$min))
$time_sec = Int(ControlGetText("","",$sec))
Dim $int_time[10]
$int_time[0] = "0"
$int_time[1] = "1"
$int_time[2] = "2"
$int_time[3] = "3"
$int_time[4] = "4"
$int_time[5] = "5"
$int_time[6] = "6"
$int_time[7] = "7"
$int_time[8] = "8"
$int_time[9] = "9"
(...)
$show_hrs = String($time_hrs)
$show_min = String($time_min)
$show_sec = String($time_sec)
$search_hrs = _ArraySearch($int_time,$time_hrs)
If Not $search_hrs = -1 Then
$show_hrs = String("0" & $search_hrs)
EndIf
$search_min = _ArraySearch($int_time,$time_min)
If Not $search_min = -1 Then
$show_min = String("0" & $search_min)
EndIf
$search_sec = _ArraySearch($int_time,$time_sec)
If Not $search_sec = -1 Then
$show_sec = String("0" & $search_sec)
EndIf