3dsmax.exe - wait until script finishes executing
Hey everyone, thanks in advance for the help.
I'm running a simple script to turn on some VRay IR Map settings. The script loads a file, switches some options, saves the file, then quits 3dsmax. (Full script at bottom of post).
I'm running this script through the command line (3dsmax.exe -q -silent -mi -U MAXScript C:\myscript.ms), and then immediately afterwards I'm running a normal render using 3dsmaxcmd.exe, all as part of a program that executes automatically.
My problem is that the first command, to run the script, seems to "finish executing" immediately, and then in the background Max opens up, runs the script, and closes. However in the meantime my program has moved on to the next command, to render the scene file, and I get a problem opening up the scene. I'm assuming this is because it's still open from the first process.
So I need one of two solutions:
1. Tell 3dsmax to wait until the script has completing executing.
2. Run my script and do my render all through the same command.
This script (very basic, and works when I run it independently):
scene_file = "PATH_TO_SCENE"
output_path = "PATH_TO_OUTPUT"
loadMaxFile scene_file quiet:true
vrayObj = renderers.production
vrayObj.options_dontRenderImage = true
vrayObj.adv_irradmap_mode = 0
vrayObj.adv_irradmap_dontDelete = true
vrayObj.adv_irradmap_autoSave = true
vrayObj.adv_irradmap_autoSaveFileName = output_path
saveMaxFile scene_file quiet:true