Hi,
can you add a commandline argument to open a file at startup?
like "C:\UCCNC\UCCNC.exe /f contour.nc"
thanks regards
// Open file from command line /f <filepath>
// Use quotes if filepath contains space: /f "\my files\cnc.tap"
string[] args = Environment.GetCommandLineArgs();
if (args.Length > 0)
for (int i = 0; i < args.Length; i++)
if ((args[i].Trim().ToUpper() == "/F") && (i < args.Length - 1))
{
string fname = args[i + 1];
if (System.IO.File.Exists(fname))
{
exec.AddStatusmessage("Opening " + fname);
exec.Loadfile(fname);
}
}
If FirstRun Then
testcmdline()
' Write code here which has to be run on first cycle only...
End If
Dim cnt As Integer = 25
Private Sub testcmdline()
If Not UC.GetLED(25) Then Return
If cnt > 0 Then
cnt -= 1
Return
End If
Dim args() As String = Environment.GetCommandLineArgs()
Dim fname As String
If args.Length > 0 Then
For i As Integer = 0 To args.Length - 2
If args(i).Trim.ToUpper = "/F" Then
fname = args(i + 1)
If IO.File.Exists(fname) Then
UC.Loadfile(fname)
End If
End If
Next
End If
FirstRun = False
End Sub
Users browsing this forum: No registered users and 7 guests