Loading an exe as a dll in maxscript
I was wondering if it is possible to load an executable as 开发者_Python百科a dll in maxscript. I want to execute an exe and the store the return values from the exe, I am using HiddenDosCommand but I have to redirect it to a file and I want to avoid that.
I was wondering if I could load it like the following
dotnet.loadAssembly ("C:\Test.exe")
I tried and I get the following "Runtime error: dotNet runtime exception: Invalid directory on URL."
Any suggestions, greatly appreciated.
Thanks
First thing that comes to mind is if you use double slash, or single. I see that stackoverflow makes 2 \'s into just 1, so to make it appear in the text here I've got to type three \'s.
You can see in the help file that all samplecode has a double slash.
dotnet.loadAssembly "C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\system.xml.dll"
So do you use doubleslash?
First of all, if you want to call an external process from maxscript, then don't load the assembly. Call System.Diagnostics.Process.Start (It's a static method), and get the exit code from that. Or you can directly instantiate a System.Diagnostics.Process instance and then run that, and then get the exit code etc...
How you want to get info from the external process back into maxscript is up to you. I'm sure there are various ways to skin that cat.
精彩评论