Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Get ClassID of different versions of program with same ProgID

Thread Tools

Get ClassID of different versions of program with same ProgID

Posts: n/a

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,

Reply With Quote
Posts: n/a
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.


Reply With Quote
Posts: n/a
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.


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
running same script on same data on two different machines -->different result Christopher Brewster Python 5 11-14-2008 08:19 PM
How to use 2 DIFFERENT VERSIONS of the SAME MODULE in the same perl program ? Yves Petinot Perl Misc 9 06-30-2004 08:26 AM
Can I use progID with TypeLib instead of UUID? Peter X ASP General 3 04-08-2004 03:10 AM
Invalid ProgID Will Microsoft Certification 0 03-02-2004 04:57 AM
.Net component and locked classid Mario Hébert ASP .Net 1 07-05-2003 02:01 PM