471,336 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,336 software developers and data experts.

Get ClassID of different versions of program with same ProgID


I am new to Python and COM, but both seem very useful for automation
as AutoCAD, ArcGIS, and my gps software all have COM interfaces and
ArcGIS actually uses python scripts.

My trouble is that I am running two versions of AutoCAD (14 and 2004).
The problem is that both have the same ProgID.

When I use:
acad=win32com.client.Dispatch('AutoCAD.Application ")
with no AutoCAD open, I get whichever version is set as default (I
tested switching my default).
With an AutoCAD session open, it will find the open session regardless
of version.

How can I get the ClassID of the different versions? I can connect to
them, is there some:
acad=win32com.client.Dispatch('AutoCAD.Application ")
print acad.ClsID # Or something like that?

I have searched and searched and cannot find such.
I have also tried looking at the makepy, but trying the id numbers I
see there I just get errors:
'Class not registered'

Oh, one note, I don't have access to the registry (at least regedit),
so can't look up the ID's there. I tried pythoncom.GetClassFile, but
get error:
'Moniker cannot open file'
I am assuming because I don't have access to registry.

Thanks for the help,

Jun 1 '07 #1
2 2953
Bummer you can't look into the registry. By convention the ProgID is
named <Program>.<Component>.<version>. Also, usually there is a
version independent ProgID that goes <Program>.<Component>. The
version independent ProgID usually points to the newest version. It
looks like that is what you are using. Many programs get away with not
using those conventions, but I'm willing to bet that there is an
'AutoCAD.Application.14' and an 'AutoCAD.Application.??'. I don't know
what will be there for 2004. Chances are that it is not '2004', but
'15' (or something similar). So, you should be able to use those
instead of the version independent one.


Jun 1 '07 #2
AutoCAD.Application.16 opens 2004, but I tried numbers before and
after and nothing opend up 14.

I figured out a way to find it though. I was using
pythoncom.GetClassFile on the AutoCAD executable instead of a drawing

I used it with .dwg twice while associated to each of the versions,
and it gave me the ClassID of the associated version.

Now just to get down to the real work and make it do something useful.


Jun 1 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by zorro | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.