|
How can I access command-line parameters from within my MAXScript?
|
|
|
|
try this:
((dotnetclass "system.diagnostics.process").getCurrentProcess()).startInfo.arguments
VFB+ : An enhanced 3dsmax frame buffer (free)
|
|
|
|
Maybe I’m doing something wrong but arguments is always “”
|
|
|
|
Yeah it doesn’t seem to be working, it was just a guess.
VFB+ : An enhanced 3dsmax frame buffer (free)
|
|
|
|
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)
|
|
|
|
That works great. Thanks.
|
|
|