3

I'm using win32COM to send commands to a software called "Robot Structural Analysis". I am able to retrieve objects that is declared inside the application, but I cannot find a way to declare new instance of a class defined in the application's API.

For example: robot = win32.gencache.EnsureDispatch("Robot.Application")

(What I can do is) l = robot.dataserver.somelist

However, in the api guidebook, there is a class named, say, XData, and I want to create a new instance of that class. What most people usually do with Excel VBA is

Dim x As New XData
x.property1 = 1
x.property2 = 2
...

But Python doesn't require declaring variable type. How can I do this using Python?

braX
  • 11,506
  • 5
  • 20
  • 33
kai
  • 31
  • 2

1 Answers1

0

To create a new class instance defined in the API using win32com and Python, one can do the followings:

  1. Windows Start -> run regedit (Registry Editor)-> HKEY_CLASSES_ROOT : Here shows all the names of COM objects, such as Robot.GeoContour

  2. In the Python code, the class instance should be declared as: contour = win32.DispatchEx("Robot.GeoContour")

kai
  • 31
  • 2