So I've been working on this tool that allows a user to run maxscript files in succession on a selection of .max files, through the use of the command line interface that max offers. Now obviously I want to run max in the background, so i'm using the following statement:
3dsmax.exe -q -silent -mip -u MAXScript 'path/to/scriptfile.ms'
I have noticed, however, that despite the documentation, this mode is neither silent nor minimized per se, nor does it generate any standard output for python to catch when max is run with a command like this. I'm running the command through PyQt using a Qprocess inside a separate QThread, so my tool's UI keeps working while max is doing its thing.
I've tried a multitude of things to MAKE max put out standard output (stdout), but nothing has worked so far. Not only that, but when max starts up, it opens an 'empty' window ( with really big, non-working window buttons ) that takes focus for a second after starting. On top of that, whenever maxscript hits a snag, max is booted completely and the maxscript debug window is opened. I don't know if I'm missing something here, but somehow I assumed 'silent' and 'minimized' mode to be silent and minimized...
Does anyone have experience with running max in minimized or silent mode? If so, do you know how to get the standard program output to work, or to actually keep max silent?
Replies
If you have a simple script you can use -mxs and the listener won't come up at all.
There is no stdout, the best you can do is create a temp text file and have your other tool read it in.
http://techarttiki.blogspot.ch/2009/12/maxscript-dotnet-sockets-with-python.html
It works really well, especially with lots of output; I used to do what you suggest, but I had to constantly check if MaxScript was writing while Python was trying to read, which made the output messy, and the program unstable. Now I just get all the data as ASCII-encoded bytes, which is a lot cleaner. It works, in other words, but it would have saved me a lot of time if Max were to generate its own stdout...