[Closed] Dynamic registration with mxscom
If you are like me, you have multiple max installations on your machine, but you want to use your favorite 3rd party text editor (via rezn8’s mxscome bridge) with all of them. However if you are like me, you are probably tired of manually pointing mxscom to your particular installation of max everytime you want to switch.
Now with the attached script, this task will be automatically done when you start max.
How is this done?
Just place this script in your <max_install>\scripts\startup directory.
How does it work?
It dynamically creates a .reg file, filling in the data for the instance of max that is running. It then runs the .reg file, and then it registers max as an OLE interface server.
The .reg file is created in your “$scripts” directory, is deleted when it’s finished. If you don’t want to delete it, then just comment out the deleteFile call in the script.
The good news about this, is that no interaction with dialog boxes is necassary when calling a command through the maxscript ‘doscommand’ function. (As you all know, manually editing the registery via a .reg file requires human interaction)
Any Limitations?
It will only work on one version of Max at a time. When multiple installations are running at the same time, it will only work for the first one. For instance:
Open Max 8,
Open Max 9,
Evaluate a script in your favorite text editor
results:
The script is evaluated in Max 8. Apparently once registered, it can’t be forcibly released by an outside app.
Now close Max 8
Evaluate a script in your favorite text editor
results:
The script is evaluated in Max 9.
I don’t normally frequent this forum, but I do get responses via email, so I will try to answer questions as best I can.
Chris Johnson
After testing this script a bit, and with help from my buddy Bill Dahlinger, I have a modified version of this script.
The first version would sometimes pop up a message box when the script ran. This was bothersome and so Bill found a way around it.
Chris Johnson