I'm hoping to find an easier way to "send" maxscripts into max from outside max to update frame ranges and a few other items.
I've written a floater for most of our main mxs tools, but wanted to have some extra flexibility for the scripts that we might generate from external apps and then "inject" into Max. Was hoping to use a command line call to do the "drag and drop" of the .ms file.
I see threads (and in the docs) where the internal DnD of max is discussed but got stumped on going from the outside-in, thanks in advance for any help!
You can use OLE Automation for that. First, you need to expose fileIn
function. Put this script inside the startup folder:
registerOLEInterface #(fileIn)
Then create a commandline util in programming/scripting language of your choice. Let's say in python with the help of pywin32, this would be the contents of maxOLE.py:
import win32com.client
import sys
conn = win32com.client.Dispatch("MAX.Application")
conn._FlagAsMethod("fileIn")
conn.fileIn(sys.argv[1])
and the commandline call:
python maxOLE.py "C:/Scripts/script.ms"
Or passing the file path directly to conn.fileIn
from that external app. Of course, you can just as well expose the execute
function and use that to pass other commands.