Detecting Autocad current version and path: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Updated author and download links, and changed format of some pages.)
m (Updated author links.)
Line 1: Line 1:
{|align=right
|<small>Author: [[{{ns:2}}:anonymous|anonymous]] ([[{{ns:3}}:anonymous|talk]], [[{{ns:-1}}:Contributions/anonymous|contrib]])</small>
|}
<br style="clear:both;">
== Description ==
== Description ==
Here is a function to find Autocad (from Autodesk) version and installation path :  
Here is a function to find Autocad (from Autodesk) version and installation path :  
Line 51: Line 55:
FunctionEnd
FunctionEnd
</highlight-nsis>
</highlight-nsis>
Page author: [[User:anonymous|anonymous]]

Revision as of 23:29, 29 April 2005

Author: anonymous (talk, contrib)


Description

Here is a function to find Autocad (from Autodesk) version and installation path :

  • $1 version number
  • $2 ACAD-ID InstallId
  • $3 path to acad.exe

The Function

Function GetCurrentAutoCADKey
;// =====================================================================
;// Construct a product key for the last AutoCAD run or installed.
;// This is referred to as the "Primary" AutoCAD.  All CLSID entries
;// and path references in the registry should be consistent with this
;// entry.
;// Parameters
;//   $1           Upon successful return
;//                   this will contain the fully qualified key that
;//                   will be found under HKEY_LOCAL_MACHINE
;//   $2           Upon successful return
;//                   will contain the ACAD-ID InstallId
;//   $3           Upon successful return
;//                   this will contain the path to acad.exe that is
;//                   associated with the current AutoCAD.
;// =====================================================================
    ;// Inspect the CurVer value at the ..\AutoCAD level to
    ;// determine the major release version key.  This will
    ;// point us to a section in the registry based upon the
    ;// version number.
    ReadRegStr $1 HKLM "Software\Autodesk\AutoCAD" "CurVer"
    ;// Must have the release version
    IfErrors 0 NoError1
      Goto Error
    NoError1:
    ;// Inspect the CurVer value at the ..\AutoCAD\szKey level to
    ;// determine the registry key id.  This will point us to a
    ;// major registry key where the Applications Subkey can be found
    ReadRegStr $2 HKLM "Software\Autodesk\AutoCAD\$1" "CurVer"
    ;// Must have the ID
    IfErrors 0 NoError2
      StrCpy $1 ""
      Goto Error
    NoError2:
    ReadRegStr $3 HKLM "Software\Autodesk\AutoCAD\$1\$2" "AcadLocation"
    ;// Must have the Path
    IfErrors 0 NoError3
      StrCpy $1 ""
      StrCpy $2 ""
      Goto Error
    NoError3:
    Error:
FunctionEnd