Friday, September 21, 2012

AutoCAD product keys in Visual LISP explained

The product key functions have some news in Visual LISP for AutoCAD 2013. These are extended functions provided by VLISP. You must issue vl-load-com before you can use the functions.

VLAX-MACHINE-PRODUCT-KEY - Returns the AutoCAD product key from the Machine hive in the Windows Registry.  (ie. "Software\\Autodesk\\AutoCAD\\R19.0\\ACAD-B001:409") VLAX-MACHINE-PRODUCT-KEY replaces VLAX-PRODUCT-KEY in releases AutoCAD 2013 and later.

VLAX-USER-PRODUCT-KEY - Returns the AutoCAD product key from the User hive in the Windows Registry.  (ie. "Software\\Autodesk\\AutoCAD\\R19.0\\ACAD-B001:409")

In AutoCAD these 2 strings will always be identical. The strings will only be different in Core Engine host applications other than AutoCAD.

VLAX-PRODUCT-KEY - Returns the AutoCAD Windows registry path. Old function, still available.

The Core Engine host AcCoreConsole.exe that ships with AutoCAD can be configured to run ’isolated’ in which case the vlax-user-product-key will return a different string than vlax-machine-product-key. Normally, it shares the HKLM/HKCU keys with AutoCAD. However, you can configure it with the /isolate switch to use a different HKCU root key. The /isolate switch can be used to prevent the changes to the system variables from affecting regular AutoCAD. This is useful when you want to set sysvars or other registry based configuration setting for AcCoreConsole.exe but you don’t want these settings to change for your AutoCAD instance.

When using the /isolate switch you also need to include an existing or new userid.

Example: AcCoreConsole.exe /isolate batch

When that is done you will notice how vlax-user-product-key will return a different value compared with the other functions:

Command: (vl-load-com)

Command: (princ (vlax-product-key))
Software\Autodesk\AutoCAD\R19.0\ACAD-B004:409
"Software\\Autodesk\\AutoCAD\\R19.0\\ACAD-B004:409"

Command: (princ (vlax-user-product-key))
Software\Autodesk\AutoCAD\R19.0\CoreUser\batch
"Software\\Autodesk\\AutoCAD\\R19.0\\CoreUser\\batch"

Command: (princ (vlax-machine-product-key))
Software\Autodesk\AutoCAD\R19.0\ACAD-B004:409
"Software\\Autodesk\\AutoCAD\\R19.0\\ACAD-B004:409"

Here AutoCAD registry product keys are explained further. The registry product keys are not the same thing as the Autodesk Product Keys that are used to differentiate products that are both sold independently and as part of a product suite.

No comments:

Post a Comment