Page 1 of 1

Can you write all status message to file?

PostPosted: Wed Jan 10, 2024 9:43 am
by Mudden
Hi!

We write a lot of information in the UCCNC status message window.
Is it possible to dump the information in the status message window to a file on disk, to open in Notepad?

I know I can write messages to file from macro, but is there already a built in functionallity to somehow get the messages in the status window over to an editor? I want to be able to perform a search-operation in the output messages.

messagewindow.JPG

Re: Can you write all status message to file?

PostPosted: Wed Jan 10, 2024 11:54 am
by ger21
You could open a file and write each message to the file when you write it to the status window. I've never done it, so I can't tell you how, but it should be possible.

Re: Can you write all status message to file?

PostPosted: Wed Jan 10, 2024 2:08 pm
by dezsoe
Normally when I write to the status box I also write to the console. (Console.WriteLn) In 1.2114 the Console plugin was rewritten and in the plugin window you can right click to get a local menu where you can copy all the contents of the console.

Re: Can you write all status message to file?

PostPosted: Thu Jan 11, 2024 6:10 pm
by dezsoe
To read the status box use AS3.Getlist() then use a StreamWriter to write the lines in reverse order:

Code: Select all
// ================================================================================================
// List status box messages to file
// ================================================================================================

List<string> lst = AS3.Getlist(2);

using (System.IO.StreamWriter sw = System.IO.File.CreateText(@"E:\status.txt"))
{
  for (int i = lst.Count - 1; i >= 0; --i)
    sw.WriteLine(lst[i]);
  sw.Close();
}

Result:
M1151.png