Updated 3ds Max Batch - 2

By Nicolas Holst - 8 Dec, 2017 - 3ds Max

So the MaxScript hinted at in the Updated 3ds Max Batch - 1 post is:

-- get hold of the parameters
-- 1. the filename of the file to load, from the filename mxsString
-- 2. the name of the box, from the boxname mxsString
filename=maxops.mxsCmdLineArgs[#filename]
logsystem.logEntry ("Filename: "+filename) broadcast:true

boxname=maxops.mxsCmdLineArgs[#boxname]
logsystem.logEntry ("Boxname: "+boxname) broadcast:true

-- first load the max file
loadmaxfile filename
logsystem.logEntry "file was opened" broadcast:true

-- now create the box
b=box name:"test"
logsystem.logEntry "box object was created" broadcast:true

-- and save the file under a new name
filename=(substring filename 1 (filename.count-4)) +"_ms_boxed"+".max"
savemaxfile filename
logsystem.logEntry "file was opened" broadcast:true

logsystem.logEntry "job done" broadcast:true

 

Quick explanation: in order to get the command line parameters we use the maxops.mxsCmdLineArgs[#parameter_name]. To print information to the logfile we use the logsystem.logEntry "string" broadcast:true calls.

Running the following on the command line:

E:\d\backburner>"c:\Program Files\Autodesk\3ds Max 2018\3dsmaxbatch.exe" add_a_box.ms -mxsString filename:"//fara06253/backburner/test.max" -mxsString boxname:"test" -log "//fara06253/backburner/max_ms.log"


The output is:


12/8/2017 15:37:13; 3ds Max Install Location: c:\Program Files\Autodesk\3ds Max 2018\
12/8/2017 15:37:13; 3ds Max Executable: 3dsmax.exe
12/8/2017 15:37:13; Secure Mode: 'OFF'
12/8/2017 15:37:13; 3ds Max Log File: "\\fara06253\backburner\max_ms.log"
12/8/2017 15:37:13; Script command: " -mxs "((maxOps.mxsCmdLineArgs = dictionary #name 'filename':\"//fara06253/backburner/test.max\" 'boxname':\"test\"); filein @\"E:\d\backburner\add_a_box.ms\")""
12/8/2017 15:37:15; Product version: 3ds Max 2018.4 Update (20.4.0.4254)
12/8/2017 15:37:17; Data collection and use is 'ON'. Change your participation anytime in the Help menu of 3ds Max.
12/8/2017 15:38:34; Task Completed Successfully


Checking what the exit code was:
E:\d\backburner>echo %ERRORLEVEL%
0

And the contents of the log file is:

2017/12/08 15:37:15 INF: [38104] [132168] Application started with secure mode state 'OFF'
2017/12/08 15:37:15 INF: [38104] [132168] Product version: 3ds Max 2018.4 Update (20.4.0.4254)
2017/12/08 15:37:17 INF: [38104] [132168] Data collection and use is 'ON'. Change your participation anytime in the Help menu of 3ds Max.
2017/12/08 15:37:26 DBG: [38104] [132168] Could not find the specified file in DefaultSettingsParser::parse()
2017/12/08 15:37:42 DBG: [38104] [132168] Graphics driver requested by the user : Nitrous
2017/12/08 15:37:42 DBG: [38104] [132168] Graphics driver actually created in the viewports : Nitrous DX11 SW
2017/12/08 15:37:57 DBG: [38104] [132168] At Nitrous init, the OGS graphics device requested is : Nitrous DX11 SW
2017/12/08 15:37:57 DBG: [38104] [132168] At Nitrous init, the OGS graphic device actually created is : Nitrous Software (= Direct3D 11 WARP )-
2017/12/08 15:38:04 DBG: [38104] [132168] Starting network
2017/12/08 15:38:27 DBG: [38104] [132168] Filename: //fara06253/backburner/test.max
2017/12/08 15:38:27 DBG: [38104] [132168] Boxname: test
2017/12/08 15:38:27 DBG: [38104] [132168] Interface8::LoadFromFile(\\fara06253\backburner\test.max)
2017/12/08 15:38:27 INF: [38104] [132168] Starting to load file: \\fara06253\backburner\test.max
2017/12/08 15:38:29 INF: [38104] [132168] SYSTEM: Production renderer is changed to Scanline Renderer. Previous messages are cleared.
2017/12/08 15:38:29 DBG: [38104] [132168] WARNING: The Populate data is missing on your system.
2017/12/08 15:38:30 INF: [38104] [132168] Done loading file: \\fara06253\backburner\test.max
2017/12/08 15:38:30 INF: [38104] [132168] SYSTEM: Production renderer is changed to NA. Previous messages are cleared.
2017/12/08 15:38:30 INF: [38104] [132168] SYSTEM: Production renderer is changed to Scanline Renderer. Previous messages are cleared.
2017/12/08 15:38:31 DBG: [38104] [132168] file was opened
2017/12/08 15:38:31 DBG: [38104] [132168] box object was created
2017/12/08 15:38:31 INF: [38104] [132168] creating file \\fara06253\backburner\test_ms_boxed.max.sv$
2017/12/08 15:38:31 INF: [38104] [132168] deleting backup file C:\Users\40578\Documents\3dsMax\autoback\MaxBack.bak
2017/12/08 15:38:32 INF: [38104] [132168] renaming \\fara06253\backburner\test_ms_boxed.max to C:\Users\40578\Documents\3dsMax\autoback\MaxBack.bak
2017/12/08 15:38:32 INF: [38104] [132168] renaming \\fara06253\backburner\test_ms_boxed.max.sv$ to \\fara06253\backburner\test_ms_boxed.max
2017/12/08 15:38:32 DBG: [38104] [132168] file was opened
2017/12/08 15:38:33 DBG: [38104] [132168] job done
2017/12/08 15:38:33 INF: [38104] [132168] StartupTemplate factoryTemplateFolder: c:\Program Files\Autodesk\3ds Max 2018\en-US\StartupTemplates
2017/12/08 15:38:33 INF: [38104] [132168] StartupTemplate userTemplateFolder: C:\Users\40578\Documents\3dsMax\startuptemplates
2017/12/08 15:38:33 INF: [38104] [132168] StartupTemplate appdataTemplateFolder: C:\Users\40578\AppData\Local\Autodesk\3dsMax\2018 - 64bit\ENU\en-US\StartupTemplates
2017/12/08 15:38:40 DBG: [38104] [132168] Stop network

 

Posted By
Published In
Tags
  • 3ds Max
  • Film & VFX
  • Design Visualization
0 Comments
To post a comment please login or register