acad.exe path..

acad.exe path..

Anonymous
Not applicable
3,662 Views
10 Replies
Message 1 of 11

acad.exe path..

Anonymous
Not applicable

How would I go about getting the Path location of acad.exe with
vb.net?  (so i don't have to hard code it)



--

Work: VISTA Ultimate/Windows 7 x32 - AMD
64 X2 Dual Core 4200 2.2GHz, 4 Gigs Ram, GeForce
6800GS 256MB


Home: VISTA Ultimate x64 - AMD 64 Quad
Core 2.2GHz, 8 Gigs Ram, GeForce 8600GT 512MB


Laptop (17" HP): VISTA Premium x32 -
color="#000000">AMD Turion X2 Dual Core TL-50 1.6GHz, 2 Gigs Ram,
color="#666666">Nvidia GeForce 6150

0 Likes
3,663 Views
10 Replies
Replies (10)
Message 2 of 11

chiefbraincloud
Collaborator
Collaborator
I went round and round about this some time ago, while trying to create a setup wizard for my program that would create a proper desktop shortcut with the profile and workspace specified. I searched all over the registry and ended up with the following code, which attempts to get the registry entry for the 'Current' drawing version, then goes to the registry entry for that version that tells windows what program to use as the 'File Editing Server'.


Try



Dim DwgCurVer As String = My.Computer.Registry.GetValue("HKEY_CLASSES_ROOT\AutoCAD.Drawing\CurVer", "", "")



If Not DwgCurVer = "" Then AcadPath = My.Computer.Registry.GetValue("HKEY_CLASSES_ROOT\" & DwgCurVer & "\protocol\StdFileEditing\server", "", "")



Catch ex As Exception



MsgBox(ex.Message, MsgBoxStyle.Critical, "AutoCAD Path Not Found")



Return



End Try



If anyone has a better way I'm all ears. There is another entry which I was not inclined to use because part of the Key string has version info in it.



AcadPath = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R17.0\ACAD-6001:409", "AcadLocation", "")

The method I used (above) has one drawback (or bonus feature, depending on how you look at it). If the machine in question has more than one version of AutoCAD on it, which many of my users do, the 'CurVer' variable will be set to the version they opened last, not the most current version on the machine.

Dave O.                                                                  Sig-Logos32.png
0 Likes
Message 3 of 11

Anonymous
Not applicable
If what you want is the AutoCAD that starts when you double-click a .DWG
file (where it may be possible that there's several releases/flavors
installed), then it's a fairly involved process:

First, open this key and get the 'CurVer' value:

HKEY_CURRENT_USER\Software\Autodesk\AutoCAD

The value of that will be one of the subkeys of the above key, and
then you open that key, and get the value of it's CurVer:

HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\RXX.X\

Where "RXX.X" is the value of the CurVer of the first key.

The result will be something like "ACAD-XXXX:XXX".

Now, you take that value, along with the 'RXX.X' and
construct another new key in HKEY_LOCAL_MACHINE:

HKEY_LOCAL_MACHINE\Software\Autodesk\AutoCAD\RXX.XX\ACAD-XXXX:XXXX

Where RXX.X and ACAD-XXXX:XXXX were the values read
from the above keys.

Open that key, and read the AcadLocation value to get the location
of the AutoCAD application.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


"C Witt" wrote in message
news:6144462@discussion.autodesk.com...
How would I go about getting the Path location of acad.exe with vb.net? (so
i don't have to hard code it)


--
Work: VISTA Ultimate/Windows 7 x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs
Ram, GeForce 6800GS 256MB
Home: VISTA Ultimate x64 - AMD 64 Quad Core 2.2GHz, 8 Gigs Ram, GeForce
8600GT 512MB
Laptop (17" HP): VISTA Premium x32 - AMD Turion X2 Dual Core TL-50 1.6GHz, 2
Gigs Ram, Nvidia GeForce 6150
Message 4 of 11

Anonymous
Not applicable

ok..  guess it's not even close to being as simple as it is in lisp..



I'll have to figure a way to keep the current method then..   (findfile
"acad.exe")



Work: VISTA
Ultimate/Windows 7 x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs
Ram, GeForce 6800GS 256MB


Home: VISTA Ultimate x64 - AMD 64 Quad
Core 2.2GHz, 8 Gigs Ram, GeForce 8600GT 512MB


Laptop (17" HP): VISTA Premium x32 -
color="#000000">AMD Turion X2 Dual Core TL-50 1.6GHz, 2 Gigs Ram,
color="#666666">Nvidia GeForce 6150





Tony Tanzillo wrote:

If what you want is the AutoCAD that starts when you double-click a .DWG 
file (where it may be possible that there's several releases/flavors
installed), then it's a fairly involved process:

First, open this key and get the 'CurVer' value:

HKEY_CURRENT_USER\Software\Autodesk\AutoCAD

The value of that will be one of the subkeys of the above key, and
then you open that key, and get the value of it's CurVer:

HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\RXX.X\

Where "RXX.X" is the value of the CurVer of the first key.

The result will be something like "ACAD-XXXX:XXX".

Now, you take that value, along with the 'RXX.X' and
construct another new key in HKEY_LOCAL_MACHINE:

HKEY_LOCAL_MACHINE\Software\Autodesk\AutoCAD\RXX.XX\ACAD-XXXX:XXXX

Where RXX.X and ACAD-XXXX:XXXX were the values read
from the above keys.

Open that key, and read the AcadLocation value to get the location
of the AutoCAD application.



0 Likes
Message 5 of 11

Anonymous
Not applicable
How do you get it in lisp?
0 Likes
Message 6 of 11

Anonymous
Not applicable

. . . . . . .



(findfile
"acad.exe")



Work: VISTA
Ultimate/Windows 7 x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs
Ram, GeForce 6800GS 256MB


Home: VISTA Ultimate x64 - AMD 64 Quad
Core 2.2GHz, 8 Gigs Ram, GeForce 8600GT 512MB


Laptop (17" HP): VISTA Premium x32 -
color="#000000">AMD Turion X2 Dual Core TL-50 1.6GHz, 2 Gigs Ram,
color="#666666">Nvidia GeForce 6150





NathTay wrote:
How
do you get it in lisp?

0 Likes
Message 7 of 11

Anonymous
Not applicable
http://msdn.microsoft.com/en-us/library/t71ykwhb.aspx
0 Likes
Message 8 of 11

Anonymous
Not applicable
It is pretty easy just add the following function and call it in your code:
{code}
Public Function GetAcadPath() As String
Dim prodId As String = Autodesk.AutoCAD.Runtime.SystemObjects.DynamicLinker.ProductKey
Dim strPath As String = My.Computer.Registry.LocalMachine.OpenSubKey(prodId).GetValue("AcadLocation")
Return strPath
End Function
{code}

HTH,
Joshua Modglin
Engineered Efficiency
Web: http://www.eng-eff.com
Blog: http://www.civil3d.com
0 Likes
Message 9 of 11

Anonymous
Not applicable

nice.   thank you.



Work: VISTA
Ultimate/Windows 7 x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs
Ram, GeForce 6800GS 256MB


Home: VISTA Ultimate x64 - AMD 64 Quad
Core 2.2GHz, 8 Gigs Ram, GeForce 8600GT 512MB


Laptop (17" HP): VISTA Premium x32 -
color="#000000">AMD Turion X2 Dual Core TL-50 1.6GHz, 2 Gigs Ram,
color="#666666">Nvidia GeForce 6150





JoshuaModglin wrote:
It
is pretty easy just add the following function and call it in your
code:
{code} Public Function GetAcadPath() As String Dim prodId As String =
Autodesk.AutoCAD.Runtime.SystemObjects.DynamicLinker.ProductKey Dim
strPath As String =
My.Computer.Registry.LocalMachine.OpenSubKey(prodId).GetValue("AcadLocation")
Return strPath End Function
{code}
HTH,
Joshua Modglin
Engineered Efficiency
Web: http://www.eng-eff.com
Blog: http://www.civil3d.com

0 Likes
Message 10 of 11

Anonymous
Not applicable
(findfile) gives you the location of the AutoCAD that you're running under.

The process I described gives you the AutoCAD that starts if you
double click a drawing file in Explorer, and can be used when there
is no running AutoCAD.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


"C Witt" wrote in message
news:6144793@discussion.autodesk.com...
. . . . . . .

(findfile "acad.exe")


Work: VISTA Ultimate/Windows 7 x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs
Ram, GeForce 6800GS 256MB
Home: VISTA Ultimate x64 - AMD 64 Quad Core 2.2GHz, 8 Gigs Ram, GeForce
8600GT 512MB
Laptop (17" HP): VISTA Premium x32 - AMD Turion X2 Dual Core TL-50 1.6GHz, 2
Gigs Ram, Nvidia GeForce 6150


NathTay wrote:
How do you get it in lisp?
0 Likes
Message 11 of 11

Anonymous
Not applicable

But as this is an internal program (to autocad) it's the "running
version" I care about.



Work: VISTA
Ultimate/Windows 7 x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs
Ram, GeForce 6800GS 256MB


Home: VISTA Ultimate x64 - AMD 64 Quad
Core 2.2GHz, 8 Gigs Ram, GeForce 8600GT 512MB


Laptop (17" HP): VISTA Premium x32 -
color="#000000">AMD Turion X2 Dual Core TL-50 1.6GHz, 2 Gigs Ram,
color="#666666">Nvidia GeForce 6150





Tony Tanzillo wrote:

(findfile) gives you the location of the AutoCAD that you're running under.

The process I described gives you the AutoCAD that starts if you
double click a drawing file in Explorer, and can be used when there
is no running AutoCAD.



0 Likes