By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,034 Members | 2,000 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,034 IT Pros & Developers. It's quick & easy.

Get ClassID of different versions of program with same ProgID

P: n/a
Hello,

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,
Ivan

Jun 1 '07 #1
Share this Question
Share on Google+
2 Replies


P: 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.

Matt

Jun 1 '07 #2

P: 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
file.

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.

Ivan

Jun 1 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.