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.