I also need to send a message (I have the code for that once I get there from here) if the gap between the two times exceeds 20 seconds or more.
My code so far is as follows. Obviously the TimeDiff variable won't calculate anything at the moment. How do I get the output of DTS1 and DTS2 in seconds (whole seconds) so I can perform the calculation correctly ? I've included what the output of DTS1 & DTS2 is
Code: Select all
FullName := A_ScriptDir "\Client.txt"
FileRead, AllLines, %FullName%
StringSplit, Line, AllLines, `n ; Line0 = nr of lines, Line1 is first line, Line2 is 2nd line, etc.
PosDTS1Line := Line0 -5
PosDTS2Line := Line0 -1
DTS1 := SubStr(Line%PosDTS1Line%, 12,8) ; Date and Time stamp
DTS2 := Substr(Line%PosDTS2Line%, 12,8)
TimeDiff := (DTS2-DTS1)
DTS1 12:56:45 (hh:mm:ss)
DTS2 12:56:45 (hh:mm:ss)
Found a solution that works as required
Code: Select all
FullName := A_ScriptDir "\Client.txt"
FileRead, AllLines, %FullName%
StringSplit, Line, AllLines, `n ; Line0 = nr of lines, Line1 is first line, Line2 is 2nd line, etc.
PosDTS1Line := Line0 -5
PosDTS2Line := Line0 -1
DTS1 := SubStr(Line%PosDTS1Line%, 12,8) ; Date and Time stamp
DTS2 := Substr(Line%PosDTS2Line%, 12,8)
;MsgBox % DTS1
T1 := StrSplit(DTS1, ":")
T2 := StrSplit(DTS2, ":")
TS1 := T1.1 * 3600 + T1.2 * 60 + T1.3
TS2 := T2.1 * 3600 + T2.2 * 60 + T2.3
TimeDiff := (TS2-TS1)
MsgBox % "Time 1 is " TS1 " seconds" "`nTime 2 is " TS2 " seconds" "`nThe Time difference is " TimeDiff " seconds"