Notifications
Clear all

[Closed] cmdline > maxscript > stdout

Hi there,

so I am starting 3ds max via the cmdline like: 3dsmax.exe -mxs “…” maxFile
and the maxscript part is doing some stuff. I would like to be able to redirect my prints, maxscript listener log etc. back the cmd window, so I can read it from there or redirect it to a file from the commandline.

I stumbled upon on-the-fly C# compilation and thought that maybe using System.Diagnostics.Process.GetCurrentProcess() and Process.StandardOutput I would be able to create a small helper class to print to stdout, but it seems the StandardOutput is read-only. My C# and .NET knowledge is very limited so far, so I wanted to ask if someone has an idea?

Cheers

1 Reply

hm okay I have tried the most simple case possible with C#:


 
 using System;
 public class Printer
 {
 	public static bool print (string text)
 	{
 		Console.Out.WriteLine(text);
 		return true;
 	}
 }
                
      I compile this snippet in my maxscript file via dotNet and run it in 3ds max via commandline:

          3dsmax.exe -U MAXScript stdout.ms 
          
     The script stdout.ms includes some calls to Printer.print, but nothing is shown in the cmd window.
     If I however redirect the output to a file like this:

         3dsmax.exe -U MAXScript stdout.ms > stdout.txt
         
     the Printer.print calls are successfully written to stdout.txt :)
     
     Is there any way to make them also display inside the cmd window? Via a different approach probably?