Python for scripting?

Richard, Thank you for your prompt reply.

I understand what you were saying about the 3DCApplication parameter to Main being the application object and I should have no trouble accessing 3DC functions through it but, where does the 3DCApplication that gets passed to Main get created? The object that creates it (whatever it’s called) andnbsp;should be exactly the WScript object that I need.

Now that I think about it, it occurs to me that in every WScript application I’ve used that instead of passing the Application object to the script, the system passes the WScript object and the creation of the Application object is done in the script itself! andnbsp;NOW I understand why!! Up to now that has always seemed redundant.

I urge you to seriously consider changing 3DC scripting to follow the same convention. Otherwise, users will ONLY be able to access the andquot;localandquot; 3DCApplication-provided functions and can never access the many andquot;genericandquot; scripting features provided by WScript itself – like WScript.Echo .

As I’m sure you now recognize, this limitation applies to VBScript as well – Python just happened to andquot;tripandquot; on it first. Incidently, JScript will have exactly the same problem as Python since it also relies on WScript.Echo to produce output.


Hello, I would like to be able to script 3DC using the Python andnbsp;[img:25mia4lr][/img:25mia4lr]
<!– m –><a class="postlink" href=""></a>&lt;!– m –>
programming language. I have used Python to script Excel, IE, and general Windows commands without any problems but, I think I need just a little more information to make it work with 3DC.

The first thing I did was to duplicate the example given in the andquot;General Purpose Scriptsandquot; section on the first page of the andquot;Using 3DC Scriptingandquot; section of the help files using VBScript. That worked just fine! The message box came up just as it should.

Then, I translated the program to Python. I was able to andquot;validateandquot; the script successfully but when I tried to run it I got a andquot;NameError: global name ‘MsgBox’ is not definedandquot; error message.

It seems that VBScript must automatically make some facilities available by default whereas Python does not. When using Python to script for other applications I’ve always had to add a line line like this:

xl_app = WScript.CreateObject(andquot;Excel.Applicationandquot;)

so I could access the Excel functions I needed like this:

xl_app.Cells(3,4).Value = 3.145

or general purpose support functions like this:

WScript.Echo(andquot;Hello from Python Scriptingandquot;)

It appears that the andquot;WScriptandquot; global value does not exist in the 3DC script environment – or might it be called something else?

Also, is it (or will it be) possible to start and control 3DC from a stand alone script? I believe that a 128 bit andquot;universal identifier numberandquot; must be created by the application developer and registered with windows upon installation to be able to do this.

I would appreciate any advice or hints!



Yes, I see your point. And I can see how this could be considered restrictive.

I think the way I have this implemented is due to the fact that I use the WSH Script Control which is an ActiveX layer around WSH. I don’t think I even have access to what it is you would like.


I don’t know a whole lot about this, but I’ll try.

MSGBOX is a VBScript function so unless python has something similar it won’t work in a Python script

I believe that the 3DCApp object that is provided to the andquot;Mainandquot; function is the 3DC equivalent of the andquot;xl_appandquot; in andquot;xl_app = WScript.CreateObject(andquot;Excel.Applicationandquot;)andquot;

So, instead of:

xl_app.cells(3,4).value = 3.14

You use:

Variable = 3DCApp.GetActiveObjectCount

I don’t believe it is possible to control 3DC externally. But I could be wrong.

I did look at Python briefly, but never got it working. But I knew absolutely nothing about Python at the time (and now)


You must be logged in to reply in this thread.