Your Products have been synced, click here to refresh
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Sub Main()[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] Dim dteNow As DateTime = DateAndTime.Now[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] Dim dteHour As Integer = dteNow.Hour[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] Dim dteMinute As Integer = dteNow.Minute[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] Dim dteSecond As Integer = dteNow.Second[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] Dim strTime As String[/COLOR][/SIZE] [/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff] strTime = Str(dteHour) + ":" + Str(dteMinute) + ":" + Str(dteSecond)[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] My.Computer.FileSystem.WriteAllText("C:\temp\xtime.txt", strTime, False)[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] MsgBox("Wait for it...", MsgBoxStyle.OkOnly) [COLOR=red]<----Seperate here[/COLOR][/COLOR][/SIZE] [COLOR=#ff0000][/COLOR][COLOR=#0000ff] [SIZE=2] dteNow = DateAndTime.Now[/SIZE] [/COLOR][/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff] Dim strStartTime As String[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] Dim dteStartHour As Integer[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] Dim dteStartMinute As Integer[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] Dim dteStartSecond As Integer[/COLOR][/SIZE] [/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff] strStartTime = My.Computer.FileSystem.ReadAllText("C:\temp\xtime.txt")[/COLOR][/SIZE][/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] [SIZE=2][COLOR=#0000ff] dteStartHour = Int(Left(strStartTime, 3))[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] dteStartMinute = Int(Mid(strStartTime, 5, 3))[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] dteStartSecond = Int(Mid(strStartTime, 9, 3))[/COLOR][/SIZE] [/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff] Dim dteEndHour As Integer = dteNow.Hour[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] Dim dteEndMinute As Integer = dteNow.Minute[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] Dim dteEndSecond As Integer = dteNow.Second[/COLOR][/SIZE][/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff] Dim intElapsedHour As Integer[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] Dim intElapsedMinute As Integer[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] Dim intElapsedSecond As Integer[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] Dim strElapsed As String[/COLOR][/SIZE] [/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] [SIZE=2][COLOR=#0000ff] If dteStartSecond > dteEndSecond Then[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] dteEndMinute = dteEndMinute - 1[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] dteEndSecond = dteEndSecond + 60[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] End If[/COLOR][/SIZE][/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff] If dteStartMinute > dteEndMinute Then[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] dteEndHour = dteEndHour - 1[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] dteEndMinute = dteEndMinute + 60[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] End If[/COLOR][/SIZE] [/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff] intElapsedHour = dteEndHour - dteStartHour[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] intElapsedMinute = dteEndMinute - dteStartMinute[/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] intElapsedSecond = dteEndSecond - dteStartSecond[/COLOR][/SIZE] [/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff] strElapsed = Str(intElapsedHour) + ":" + Str(intElapsedMinute) + ":" + Str(intElapsedSecond)[/COLOR][/SIZE][/COLOR][/SIZE] [COLOR=#0000ff][/COLOR] [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff] MsgBox("Elapsed time: " + strElapsed, MsgBoxStyle.OkOnly)[/COLOR][/SIZE][/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff] My.Computer.FileSystem.DeleteFile("C:\temp\xtime.txt")[/COLOR][/SIZE][/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff] [SIZE=2][COLOR=#0000ff] End Sub[/COLOR][/SIZE][/COLOR][/SIZE]
Sub Main() Dim Beforetime As String Beforetime = Timer Beforetime = CInt(Beforetime) Open "I:\CMM_MASTER_PROGRAMS\Scripts\TIMEVARIABLE.TXT" For Output As #1 Print #1, Beforetime Close #1 End Sub
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |