My problem is such.. Used the VB editor within Mach to edit... which is frustrating enough, as it is not saving reliably.... ugh..
using the "play" button in the editor, checks out fine.. works fine.. everything SEEMED to work fine yesterday when i wrote all this, but now i'm getting an error "error on line 84--internal error <homeit>"
This corresponds to the "getoemled(800)" line within the "homeit" sub...
also getting an error on Line 88... corresponds to "msgbox........" line
this code is contained within the "reset" button, and I'm using it to do maintenance prompts, and a "must home before running" lockout...
anybody have any thoughts/suggestions?
Thanks in advance!!
*edit* running mach Version R2.0.061 on the laptop being used for testing anyway.
'*************************************************************
'*************************************************************
'Purpose:
'Every Monday, when the Machine is brought out of a "reset" state, a prompt is initiated to grease
'the machine. A Maintenance Log is created/appended with a time/date stamp, and an Operators Name.
'If the Date Stamp is the same as the last stamp in the maintenance file, the maintenance request is ignored.
'
'The state of the machine is checked upon coming out of The reset, and in conjunction with the "ref home" and "cycle start"
'buttons, a "HOME" action is forced prior to running ANY GCode Files.
'*************************************************************
'*************************************************************
Sub Main()
Call Maintreminder() 'determine if maintenance is required & take care of process if necessary
Call Homeit() 'Warn about homing after reset & prevent Gcode runs
End Sub
'**************************************************************
'**************************************************************
'* Subroutine: Maintreminder
'* Purpose: create a maintenance reminder prompt every Monday upon Resetting the machine
'* Programmer: Nathan Haskell
'* Date: 5-17-07
'***************************************************************
Sub Maintreminder()
Today = Date () 'Obtain Current Date
DOW = Weekday (Today) 'Calculate Day Of Week (1-7)
Clk = Time() 'Obtain Time Of Day
Open "Maintenance.txt" For Input As #1 'Search Maintenance Log for last
Do While Not EOF (1) 'Maintenance Occurance
Line Input #1, Lastline
Loop
Close #1
LastMaint = DateValue(Lastline)
If DOW = 2 Then 'Check to see if Today is Monday
If Today = LastMaint Then 'And compare against the last Maintenance Log
Exit Sub 'If the last Maintenance Log was from Today, ignore
Else
'Otherwise, Perform Maintenance Routine!
Begin Dialog Maintdlg1 60,60, 200,70, "Maintenance Required!"
TEXT 60,10,90, 12, "Machine Must Be Greased"
TEXT 10,24, 50,12, "Operator Name"
TEXTBOX 60, 22, 108, 12,.nameStr
OKBUTTON 80, 54, 40, 12,.okbtn
End Dialog
'* display the dialogbox for operator name input until a valid name (aka, anything starting with A or greater) is displayed...
'* Also continue to display until the "OK" button is pressed, to eliminate just clicking out of it...
Dim Maintbox As Maintdlg1
Do
Do
Dialog Maintbox
Loop Until Maintbox.nameStr >="A"
Loop Until Maintbox.okbtn=-1
MsgBox "Thank you " & Maintbox.nameStr & "!"
Open "Maintenance.txt" For Append As #1
Print #1, " "
Print #1, "Greased at " & Clk & " By " & Maintbox.nameStr
Print #1, Today
Close #1
End If
End If
End Sub
'******************************************************
'******************************************************
Sub Homeit()
If GetOEMLED (800) = false Then 'If Placing into a Reset, then just reset
DoOEMButton (1021)
Exit Sub
Else 'Otherwise, Call the message box, then reset
MsgBox "Machine Must Be Homed After Startup Or A Reset"
DoOEMButton (1021)
End If
End Sub