Finding Autocad

Finding Autocad

Anonymous
Not applicable
351 Views
9 Replies
Message 1 of 10

Finding Autocad

Anonymous
Not applicable
I am looking for a way to locate the installation path for Autocad 2000. I
would prefer to do it without starting Autocad. I can get the registry value
but that value can vary depending on the product you run. For example, mine
reads as "Software\Autodesk\AutoCAD\R15.0\ACAD-8:409", but the portion that
reads "8:409" can be different for various installations. How can I
consistently get the "AcadLocation" key regardless of the product that was
installed. I tried using an AppPath("acad.exe") function but when I ran it
on a different machine, it found Release 14.
0 Likes
352 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
Every A2K installation will have a seperate key under
HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R15.0. I can't comment on R14
since I do not have access to it but I suspect it would be similar. From
there, you can extract the AcadLocation.

--
Visit me at http://www2.stonemedia.com/franko

"Tim Nary" wrote in message
news:ef06a7b.-1@WebX.SaUCah8kaAW...
> I am looking for a way to locate the installation path for Autocad 2000. I
> would prefer to do it without starting Autocad. I can get the registry
value
> but that value can vary depending on the product you run. For example,
mine
> reads as "Software\Autodesk\AutoCAD\R15.0\ACAD-8:409", but the portion
that
> reads "8:409" can be different for various installations. How can I
> consistently get the "AcadLocation" key regardless of the product that was
> installed. I tried using an AppPath("acad.exe") function but when I ran it
> on a different machine, it found Release 14.
>
0 Likes
Message 3 of 10

Anonymous
Not applicable
Exactly, but how can I get the key(s) that exists under "R15.0" (or all of
them) without knowing what the key name may be?
0 Likes
Message 4 of 10

Anonymous
Not applicable
I'm sure Randall Rath has some API trick up his sleeve. Personally, I use
RegObj.dll. I've attached it to this message. Copy it into your system
folder and register it. The start a VBA project, add a reference to the
"Registry Manipulation Classes" and paste in this code:

Public Sub ListAcadLocations()

Dim key As RegKey, subKey As RegKey

Set key =
RegKeyFromString("\HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R15.0")

For Each subKey In key.SubKeys
Debug.Print subKey.Name
Debug.Print subKey.Values("AcadLocation").Value
Next

End Sub

--
Visit me at http://www2.stonemedia.com/franko

"Tim Nary" wrote in message
news:ef06a7b.1@WebX.SaUCah8kaAW...
>
> Exactly, but how can I get the key(s) that exists under "R15.0" (or all of
> them) without knowing what the key name may be?
>
0 Likes
Message 5 of 10

Anonymous
Not applicable
Well, Frank beat me to it, but here's another solution. 🙂
I don't have A2K, so let me know if it works.

- Adam

Public Function Acad2KPath()
On Error Resume Next
Dim strClsId As String 'class ID for A2K
Dim strPath As String 'path returned from registry
Dim wsh As IWshRuntimeLibrary.IWshShell
Set wsh = CreateObject("Wscript.Shell") 'create windows scripting object
strClsId = wsh.RegRead("HKEY_CLASSES_ROOT\AutoCAD.Application.15\CLSID\")
'get the Class ID for A2K
strPath = wsh.RegRead("HKEY_CLASSES_ROOT\CLSID\" & strClsId &
"\LocalServer32\") 'get the automation path
If strPath <> "" Then 'make sure the key exists
strPath = VBA.Left$(strPath, Len(strPath) - 12) 'trim off "
/Automation"
If Dir(strPath) <> "" Then 'make sure the file exists
Acad2KPath = strPath 'set function value
End If
End If
Set wsh = Nothing
End Function

"Tim Nary" wrote in message
news:ef06a7b.-1@WebX.SaUCah8kaAW...
> I am looking for a way to locate the installation path for Autocad 2000. I
> would prefer to do it without starting Autocad. I can get the registry
value
> but that value can vary depending on the product you run. For example,
mine
> reads as "Software\Autodesk\AutoCAD\R15.0\ACAD-8:409", but the portion
that
> reads "8:409" can be different for various installations. How can I
> consistently get the "AcadLocation" key regardless of the product that was
> installed. I tried using an AppPath("acad.exe") function but when I ran it
> on a different machine, it found Release 14.
>
0 Likes
Message 6 of 10

Anonymous
Not applicable
Thank you, I got it to work using the REGOBJ.dll
0 Likes
Message 7 of 10

Anonymous
Not applicable
Hi Tim,

Here is a simple vbscript file which will extract the Acad 2000 installation
path.

'create a instance of Wsript object
Set po_scr = CreateObject("Wscript.Shell")
ps_regval =
po_scr.regread("HKLM\Software\Autodesk\Autocad\R15.0\ACAD-1:409\AcadLocation
")
msgbox ps_regval


Remember this sample code extracts the installation path of vanilla AutoCAD
2000 only and not any other products like MDT, ADT, LDDT etc.

Cheers,
Thilak

Tim Nary wrote in message
news:ef06a7b.4@WebX.SaUCah8kaAW...
>
> Thank you, I got it to work using the REGOBJ.dll
>
0 Likes
Message 8 of 10

Anonymous
Not applicable
Nice. But his point was that he may not know exactly which key to look for
as the key varies with the flavor of AutoCAD installed on the machine. For
example, your script will not allow him to locate an R14 installation or a
Mechanical Desktop 4 installation.

--
Visit me at http://www2.stonemedia.com/franko

"Thilak" wrote in message
news:ef06a7b.5@WebX.SaUCah8kaAW...
> Hi Tim,
>
> Here is a simple vbscript file which will extract the Acad 2000
installation
> path.
>
> 'create a instance of Wsript object
> Set po_scr = CreateObject("Wscript.Shell")
> ps_regval =
>
po_scr.regread("HKLM\Software\Autodesk\Autocad\R15.0\ACAD-1:409\AcadLocation
> ")
> msgbox ps_regval
>
>
> Remember this sample code extracts the installation path of vanilla
AutoCAD
> 2000 only and not any other products like MDT, ADT, LDDT etc.
>
> Cheers,
> Thilak
>
> Tim Nary wrote in message
> news:ef06a7b.4@WebX.SaUCah8kaAW...
> >
> > Thank you, I got it to work using the REGOBJ.dll
> >
>
0 Likes
Message 9 of 10

Anonymous
Not applicable
You really don't have to go through all of that, you
can find the location of Acad.exe here:

HKEY_CLASSES_ROOT\AutoCAD.Drawing.15\protocol\StdFileEditing\server

Adam Waller wrote:
>
> Well, Frank beat me to it, but here's another solution. 🙂
> I don't have A2K, so let me know if it works.
>
> - Adam
>
> Public Function Acad2KPath()
> On Error Resume Next
> Dim strClsId As String 'class ID for A2K
> Dim strPath As String 'path returned from registry
> Dim wsh As IWshRuntimeLibrary.IWshShell
> Set wsh = CreateObject("Wscript.Shell") 'create windows scripting object
> strClsId = wsh.RegRead("HKEY_CLASSES_ROOT\AutoCAD.Application.15\CLSID\")
> 'get the Class ID for A2K
> strPath = wsh.RegRead("HKEY_CLASSES_ROOT\CLSID\" & strClsId &
> "\LocalServer32\") 'get the automation path
> If strPath <> "" Then 'make sure the key exists
> strPath = VBA.Left$(strPath, Len(strPath) - 12) 'trim off "
> /Automation"
> If Dir(strPath) <> "" Then 'make sure the file exists
> Acad2KPath = strPath 'set function value
> End If
> End If
> Set wsh = Nothing
> End Function
>
> "Tim Nary" wrote in message
> news:ef06a7b.-1@WebX.SaUCah8kaAW...
> > I am looking for a way to locate the installation path for Autocad 2000. I
> > would prefer to do it without starting Autocad. I can get the registry
> value
> > but that value can vary depending on the product you run. For example,
> mine
> > reads as "Software\Autodesk\AutoCAD\R15.0\ACAD-8:409", but the portion
> that
> > reads "8:409" can be different for various installations. How can I
> > consistently get the "AcadLocation" key regardless of the product that was
> > installed. I tried using an AppPath("acad.exe") function but when I ran it
> > on a different machine, it found Release 14.
> >

--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.tanzillo@worldnet.att.net */
/* http://www.caddzone.com */
/*********************************************************/
0 Likes
Message 10 of 10

Anonymous
Not applicable
"Tony Tanzillo" wrote in message
news:392081C9.585BB78E@worldnet.att.net...
> You really don't have to go through all of that, you
> can find the location of Acad.exe here:
>
> HKEY_CLASSES_ROOT\AutoCAD.Drawing.15\protocol\StdFileEditing\server
>

My registry does not have that key for R14, but it sounds like it is there
for the A2K version. 🙂
Since I don't have A2K installed, I did all my testing with the R14 version,
and assumed that A2K would have the LocalServer32 key.
Thanks for the tip.

- Adam

--
Enum SystemInfo
Cad_Software = "AutoCAD 14.01"
VB_Product = "VBA / VB6"
Platform = "WinNT4 SP5"
End Enum
0 Likes