Notifications
Clear all

[Closed] Python + MXS

Yeah, you need to register Max with COM, that error means Windows doesn’t know about it.

Try this. Start Max then run the attached MaxScript. It should add the necessary info to registry. Then try to do your Dispatch again and see what happens.

1 Reply
(@cyhiso)
Joined: 10 months ago

Posts: 0

Thank u very much! everything it’s ok right now:)

Sure thing. I also added the code from that script to registerPythonCom.ms in my sample files from my GDC talk.

If anyone was having problems getting my COM samples to work before, grab the updated ZIP and give it a go.

2 Replies
(@jedie)
Joined: 10 months ago

Posts: 0

I have run registerPythonCom.ms from GDC2008_AdamPletcher_PythonSamples.zip in 3dsmax 2009 x64 on vista. I get this error:

command_from_python()
 OK
 -- Error occurred in create_reg_key(); filename: D:\3DS Scripts\registerPythonCom.ms; position: 530
 --  Frame:
 --   key_name: "MAX.Application"
 --   key_value_name: ""
 --   key_value_type: #REG_SZ
 --   key_value: "OLE Automation MAX Application"
 --   reg_key: undefined
 --   HKey: HKEY_CLASSES_ROOT
 --   called in anonymous codeblock
 --  Frame:
 --   max_version: "11"
 --   create_reg_key: create_reg_key()
 --   reg_key: undefined
 --   write_sub_key_data: write_sub_key_data()
 -- Type error: HKey requires HKey, got: undefined
 create_python_return_value()
 command_from_python()
 OK

Is there a problem to create reg keys without admin rights???
Where can i find the last scripts from you?

(@jedie)
Joined: 10 months ago

Posts: 0

I have run registerPythonCom.ms from GDC2008_AdamPletcher_PythonSamples.zip in 3dsmax 2009 x64 on vista. I get this error:

command_from_python()
 OK
 -- Error occurred in create_reg_key(); filename: D:\3DS Scripts\registerPythonCom.ms; position: 530
 --  Frame:
 --   key_name: "MAX.Application"
 --   key_value_name: ""
 --   key_value_type: #REG_SZ
 --   key_value: "OLE Automation MAX Application"
 --   reg_key: undefined
 --   HKey: HKEY_CLASSES_ROOT
 --   called in anonymous codeblock
 --  Frame:
 --   max_version: "11"
 --   create_reg_key: create_reg_key()
 --   reg_key: undefined
 --   write_sub_key_data: write_sub_key_data()
 -- Type error: HKey requires HKey, got: undefined
 create_python_return_value()
 command_from_python()
 OK

Is there a problem to create reg keys without admin rights???
Where can i find the last scripts from you?

I’ve added some functions to my BackBurner Class and made it directly available in 3dsmax via a COM connection… Though I’d post the latest since there’s a few posts about BB control on the forum currently…

   Just unzip in 
   <max>\\plugins\\Scripted Global Functions\\
   
   There will be a command window flash when Max starts and then in maxScript there should be a global structure PythonLib with a backburner property.
   
   PythonLib.BackBurner.GetJobList <manager name> <manager port> 
   
   Should list ALL the jobs on that manager.
   
   More functions coming soon !
 
 Edit1: Sorry About that typo... New zip...

Kramsurfer it is giving me errors in 2009 (x64 and x86):

– Error occurred in anonymous codeblock; filename: C:\Program Files\Autodesk\3ds Max 2009\PlugIns\Script Global Functions\PythonLib_BackBurner.ms; position: 237
– Frame:
– pythonModualsStruct: StructDef:pythonModualsStruct
– Error occurred during fileIn in <File:C:\Program Files\Autodesk\3ds Max 2009\PlugIns\Script Global Functions\PythonLib_BackBurner.ms>
>> MAXScript Auto-load Script Error – C:\Program Files\Autodesk\3ds Max 2009\PlugIns\Script Global Functions\PythonLib_BackBurner.ms Exception: – Runtime error: createOLEObject: can’t find server PythonLib.BackBurner <<
-Eric

Edit: the path according to the script is plugins\Global Scripted Functions\, not \Plugins\Script Global Functions\ as documented. You may want to update that. Still errors do to the spaces in the paths, I believe.

EDIT2: I modified the script to get rid of the error change the doscommand line to:

dosCommand ( “””+( getDir #maxRoot ) +“plugins\Script Global Functions\PythonLib_BackBurner.py””)

Here is a modified PythonLib_Backburner.ms, that won’t flash the dos window:

(
struct pythonModualsStruct ( BackBurner )
hiddendosCommand ( "\""+( getDir #maxRoot ) +"plugins/Script Global Functions/PythonLib_BackBurner.py\"") startpath:"c:/"
global PythonLib = ( pythonModualsStruct BackBurner:(createOLEObject("PythonLib.BackBurner")) )	
)

-Eric

For some reason all .GetJobList returns is “Sorting JobList”. No jobs are returned, eventhough I have 5 in the queue.

-Eric

Always an issue when you try to quickly tear a piece of something out of a bigger construct!

 Updated PythonLib.BackBurner

Thanks for the update, but the joblist output really isn’t helpful:

0FEF27CE Complete Autodesk 3ds Max 2009 (32-bit
On top of that it is returning a multi-line string, rather than something useful.

-Eric

It returns a job handle, very useful for controlling a job or getting further information about that job. Current rendering status of that job, The name of the job and what type of job it is. That’s all BB returns for a joblist and it in plain English in one string and tab delimited for easy use in MXscript.

Sorry it wasn’t useful to you.

As you can see from what I posted it is turnacating the info, so I get the handle, status, and part of the version.

-Eric

Page 18 / 26