Option Explicit
'********DO NOT remove or change the expand line or the included file contents******************
'  MachStdMIll license terms REQUIRE that the copyright and License terms remain a part of this source file
#expand <Masters\Headers\CopyRightAndLicenseNotice>	
'**************************************************************************************

' code to open mach error history file
'
' we use the non-GCode editor for the history file.
' this leaves the user specified editor available for G-code editing
' we do this becuase many gcode editors reject plain text as invalid gcode syntax
'
#expand <Masters\Headers\MSMConstants>
#expand <Masters\Headers\MSMConfigFunctionNumbers>

	Dim CmdString As String
	Dim FileName as string
	Dim objMSMFSO As Object
	
	FileName = GetMainFolder() & "LastErrors.txt"	
	
	Call MSMRunScript("Masters\Scripts\Common\MSMCOnfig", MSMGetNGCEditorInfo)
	
	On Error Resume Next
	Set objMSMFSO = CreateObject("Scripting.FileSystemObject")
	If Err Then
		MsgBox "OpenHistory FSO creation failed. Err: " & Err & " " & Err.Description, 0, "MSM History Button"
		On Error GoTo 0     ' cancel temp error handler
		exit sub
	End If
	On Error GoTo 0     ' cancel temp error handler

	if not objMSMFSO.FileExists(GetUserLabel(MSMNonGCodeEditorUserLabel)) then
				msgbox "Configured Non-GCode Editor does not exist on disk...      " & Chr(10) & Chr(13) & _
				"Please check Non-Gcode Editor utility configuration.", _
				0+64, "Utility not present."	
		Set objMSMFSO = Nothing
		exit sub
	end if
	
	' config info reloaded from file, FQFN in UserLabel
	CmdString = """" & GetUserLabel(MSMNonGCodeEditorUserLabel) & """" & " " & """" & FileName & """"
	'MsgBox "CS = " & cmdstring
	Shell(CmdString)  
	Set objMSMFSO = Nothing	
	Exit sub	' return from button Call

#expand <Masters\Scripts\Common\Expands\MSMRunScript>
#expand <Masters\Scripts\Common\Expands\RSErrorText> 
