Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / Access command-line parameters from within my MAXScript?
  RSS 2.0 ATOM  

Access command-line parameters from within my MAXScript?
Rate this thread
 
64243
 
Permlink of this thread  
avatar
  • jprisbe
  • Posted: 07 February 2012 04:49 AM
  • Location: Grand Rapids, MI
  • Total Posts: 10
  • Joined: 19 January 2012 11:43 PM

How can I access command-line parameters from within my MAXScript?



Replies: 0
avatar
  • lo_
  • Posted: 07 February 2012 07:29 AM

try this:

((dotnetclass "system.diagnostics.process").getCurrentProcess()).startInfo.arguments


VFB+ : An enhanced 3dsmax frame buffer (free)

Replies: 0
avatar
  • jprisbe
  • Posted: 10 February 2012 05:32 AM

Maybe I’m doing something wrong but arguments is always “”



Replies: 0
avatar
  • lo_
  • Posted: 10 February 2012 05:54 PM

Yeah it doesn’t seem to be working, it was just a guess.



VFB+ : An enhanced 3dsmax frame buffer (free)

Replies: 0
avatar
  • lo_
  • Posted: 12 February 2012 11:15 PM

Here you go.. this code will get you the entire command line used to start the process. It is a simple job from here to filter out the file path and name:

fn get3dsmaxCommandLineArguments =
(
 
local result
 dotnet
.loadassembly "System.Management.dll"
 
local queryStr "select CommandLine from Win32_Process where Name='3dsmax.exe'"
 
local objSearcher dotnetobject "System.Management.ManagementObjectSearcher" queryStr
 local objCollection 
objSearcher.get()
 if (
objCollection.count 0) do
 (
 
local enumerator = (objcollection.getenumerator())
 
enumerator.movenext()
 
result enumerator.current.item["Commandline"]
 
)
 
objSearcher.dispose()
 
objCollection.dispose()
 
 
result
)


VFB+ : An enhanced 3dsmax frame buffer (free)

Replies: 0
avatar
  • jprisbe
  • Posted: 13 February 2012 12:49 AM

That works great. Thanks.



Replies: 0