Unfortunately The 'Net Time' Command In My Environment returns :
quote:
L'heure en cours sur \\MyServer Est 8/7/2002 3:10 PM
So I Wrote these modifications to Handle H12/H24 Format and Garbage Text In Temp. TimeFile and would be glad to read any comment :
code:
$Computer = "Fill With Your Target Computer's Name"
; The Following Line Is The RealTime Command (UnComment when Really Implementing Routine) :
;Shell "%comspec% /c net time \\$computer > %temp%\$computer"
; Use The Following Line For Tests to Limits (Delete when Really Implementing Routine) :
Shell "%comspec% /c Echo Damn'd String Used As Test 2:58 PM > %temp%\$computer"
$Dummy = Open(1,"%temp%\$computer")
If $Dummy = 0
$LineRead = Ucase(Rtrim(Ltrim(ReadLine(1))))
? "Line Read In Temp. TimeFile : " + $LineRead + " [Transformed]"
$Dummy = Close(1)
If $Dummy = 0
$SeparatorPosition = InStr($LineRead,":")
If $SeparatorPosition > 0
$Hours = Val(SubStr($LineRead,$SeparatorPosition-2,2))
? "Hours Raw Value Extraction : " + "$Hours" + " [Type : " + VarType($Hours) + "]"
If SubStr($LineRead,Len($LineRead)-1,2) = "PM" AND $Hours < 12
; I Test $Hours < 12 'cause I've Seen '22:30 PM'
; returned By 'At + CR' Command in my Console ...
? "AM / PM Determination : PM"
$Hours = $Hours + 12
? "AM / PM Determination : PM"
? "New Value In H24 Format : " + "$Hours" + " [Type : " + VarType($Hours) + "]"
Else
? "AM / PM Determination : AM, Or H24 Format"
? "Value Of Hours UnChanged : " + "$Hours" + " [Type : " + VarType($Hours) + "]"
EndIf
$minutes = Val(SubStr($LineRead,$SeparatorPosition+1,2))
? "Minutes Raw Value Extraction: " + "$Minutes" + " [Type : " + VarType($Minutes) + "]"
Select
Case $minutes = 58
$Hours = $Hours + 1
If $Hours = 24
$Time = "00:00"
Else
$Time = "$Hours" + ":00"
EndIf
Case $minutes = 59
$Hours = $Hours + 1
If $Hours = 24
$Time = "00:01"
Else
$Time = "$Hours" + ":01"
EndIf
Case 1
$minutes = $minutes + 2
If $minutes < 10
$minutes = "0" + $minutes
EndIf
$Time = "$Hours" + ":" + "$minutes"
EndSelect
? "Final Result (H24 / Txt) : " + "$Time" + " [Type : " + VarType($Time) + "]"
Else
? "No ':' Time Separator Found ..."
EndIf
Else
? "Can't Close TempTimeFile ..."
EndIf
Else
? "Can't Open TempTimeFile ..."
EndIf
;Shell "%comspec% /c AT \\$computer $Time /interactive C:\Temp\Script.cmd"