Saturday, June 27, 2009

Hidden HiddenDOSCommand details

Twice in recent months I've been bitten by MaxScript's HiddenDOSCommand.

It was added in 3ds Max 2008 as a way to issue DOS commands without bringing up an ugly command prompt. Sounds great but what the docs don't tell you is that the optional "startpath:" argument is actually not optional at all. If you leave it out you'll receive a cryptic error like this:.

HiddenDOSCommand "notepad %temp%\\cmdout.tmp" prompt:"Waiting..."
-- Error! CreateProcess(cmd /e:on /d /c "notepad %temp%\hiddencmdout.tmp") failed!
Note, that command was pasted from Example Usage in the MaxScript docs for HiddenDOSCommand. It will not work, nor will the other examples listed there unless you include "startpath"....
HiddenDOSCommand "notepad %temp%\\cmdout.tmp" prompt:"Waiting..." startpath:"C:\\"
true
This may have been addressed in the helpfile for 3ds Max 2010, I haven't checked. This can be Google fodder in the meantime.

4 comments:

Jason Brackman said...

Just checked the 2010 docs. In regards to the 'startpath':

NEW in 3ds Max 2010: In versions prior to 3ds Max 2010, omitting this optional argument resulted in function failure. This has been corrected in 3ds Max 2010.

loocas said...

Confirmed, in Max 2010 this issue has been fixed.

Adam Pletcher said...

Yay. Thanks for the update.

Chupon said...

Hey! I was just searching for advices on this damn HiddenDosCommand function (yeah, still working with 3ds 2009...), thanks for the tip! :)