// Macroloop to log when gcode file was loaded and when running gcode file string strOldGcodeFilename = ""; while(loop) { string strCurrGcodeFilename = exec.Getgcodefilename(); // Get filename of current loaded gcode file if (strCurrGcodeFilename != strOldGcodeFilename) { string strCurrDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss tt"); // get current Date & Time using (System.IO.StreamWriter writer = System.IO.File.AppendText(@"C:\UCCNC\Example_codes\LoadRunLogFile.txt")) { writer.WriteLine("File Loaded: " + strCurrGcodeFilename + " , " + strCurrDateTime); writer.Flush(); } strOldGcodeFilename = strCurrGcodeFilename; } if (AS3.GetLED(54)) //Waits for the cycle start LED on the main screen. { if (exec.Getvar(900) != 5 ) { //string windowsTime = "2/21/2009 10:35 PM"; //DateTime time = DateTime.Now.Parse(windowsTime); string strCurrDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss tt"); // get current Date & Time using (System.IO.StreamWriter writer = System.IO.File.AppendText(@"C:\UCCNC\Example_codes\LoadRunLogFile.txt")) { writer.WriteLine("File Running: " + strCurrGcodeFilename + " , " + strCurrDateTime); writer.Flush(); } exec.Setvar(5,900); } } else { exec.Setvar(0,900); } Thread.Sleep(50); }