Running script from an external app?

Hiyo all,

I was working on something and got an idea that calls for running a mel or maxscript from an external app. Maya/max would be open at the time, but I was wondering if this is possible? and if so, how? :?:

cheers!

I think most people are using win32 com server for that, as explained here:

There’s a couple of things you can do for Maya, you can use Python and just import the maya module which will keep it open and just run python commands on the fly, or you can launch maya and open a command port and send mel commands through there

I think max has some stuff built in for that. I know that 2010 does, but it’s part of the C# utilities included - you can call out to a maxscript function from .Net.

Argh I don’t have the 2010 SDK installed here, I think the docs for it are in there. When I relocate it I’ll post some. I think it’s been mentioned on the board somewhere if you search!

In the sample files for my GDC 2008 Python lecture there’s some examples on how to run MaxScript code in Max via COM. The max-side setup for this would be the same for any COM-enabled language, not just Python.

Specifically take a look at “registerPythonCom.ms” in the 6_COM folder. The real heart of that is the MaxScript command registerOLEInterface. Have a look at that in the MXS help file.

Also in that 6_COM folder is an example of doing a similar thing in Maya (using command ports instead of COM). Look at the header comments in the “1_createSpheresMaya.py” file. It explains the MEL-fu needed to make Maya do this. Again, that part isn’t Python-specific… any language with TCP/socket support can have a go.

ah you guys are champs! :D:

thanks a bunch