-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathM1003.m1s
86 lines (66 loc) · 2.03 KB
/
M1003.m1s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
'M1003.m1s Get End Time point and calc, and post file
Dim StartTime As String
Dim StartDate As String
Dim EndTime As String
Dim EndDate As String
Dim File As String
Dim Days
EndTime = Time(Now)
EndDate = Date()
SecEnd = Second(EndTime)
MinEnd = Minute(EndTime)
HrEnd = Hour(EndTime)
DyEnd = Day(EndDate)
SecStart = GetVar(100)
MinStart = GetVar(101)
HrStart = GetVar(102)
DyStart = GetVar(103)
File = FileName()
Open "C:\Users\cnc\Google Drive\Log\TimeFile" For Input As #1 ' Open file.
Line Input #1, TextLine ' Read line into variable.
StartTime = TextLine ' get start time.
Line Input #1, TextLine ' Read line into variable.
StartDate = TextLine ' get start date.
Close #1 ' Close file.
Code "G4 P0.5"
While IsMoving
Wend
If HrEnd<HrStart Then
Hr=((24-HrStart)+(24-(24-HrEnd)))
Else
Hr=(HrEnd-HrStart)
End If
If MinEnd<MinStart Then
Min=((60-MinStart)+(60-(60-MinEnd)))
Else
Min=(MinEnd-MinStart)
End If
If SecEnd<SecStart Then
Sec=((60-SecStart)+(60-(60-SecEnd)))
Else
Sec=(SecEnd-SecStart)
End If
If (DyEnd-DyStart)= 0 Then
Days = 0
End If
If ((DyEnd-DyStart)=1) And (HrEnd<HrStart) Then
Days = 0
End If
If ((DyEnd-DyStart)=1) And (HrEnd>HrStart) Then
Days = 1
End If
If ((DyEnd-DyStart)>1) Then
Days = (DyEnd-DyStart)
End If
'Dim As String writeOut
'writeOut = "File Name: " & File & "Start Time: " & StartTime & "Start Date: " & StartDate & "End Time: " & EndTime & "End Date: " & EndDate & "Total Time: " & " Days: " & Days & " Hours: " & Hr & " Mins: " & Min & " Secs: " & Sec
Kill "C:\Users\cnc\Google Drive\Log\TimeFile"
Open "C:\Users\cnc\Google Drive\Log\Log.csv" For Output As #2 ' Open to write file.
Write #2, "File Name: " & File
Write #2, "Start Time: " & StartTime, "Start Date: " & StartDate
Write #2, "End Time: " & EndTime, "End Date: " & EndDate
Write #2, "Total Time: " & " Days: " & Days & " Hours: " & Hr & " Mins: " & Min & " Secs: " & Sec
Close #2
Code "G4 P0.5"
While IsMoving
Wend