Check to see if OpenDCL has been installed.

Started by EricStiles · 2019-05-06 02:26 UTC · 5 replies · SMF topic #2678

I share my lisp programs with others in my company.  I often don't know who they are. Some of my lisp programs use OpenDCL.  In my lisp code I would like to have a way to check to see if OpenDCL has been installed and if not, send the user a message letting him or her know that they need to install it first and/or contact me for help.  And close the lisp program properly. 
Does anyone know of a way in lisp to check the computer to see if OpenDCL has been installed?
Hi, the only way I see without running OpenDCL command is to search the Windows registry whether the key HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R\ACAD-\Applications\OpenDCL\Commands exists and the files "C:\Program Files (x86)\Common Files\OpenDCL\OpenDCL.x64..arx" exist.

Regards, Fred
The first part of Tom's suggestion can look like this (tested on BricsCAD):
; (OpenDclInstalled_P)
(defun OpenDclInstalled_P ()
  (and
    (vl-registry-read
      (strcat
        "HKEY_LOCAL_MACHINE\\"
        (vlax-product-key)
        "\\Applications\\OpenDCL\\Commands"
      )
      "OPENDCL"
    )
  )
)


IMO this test would be enough.
Thank you Fred and Roy and thanks for the code Roy.  I only know Lisp and messing with the registry scared me.  I didn't realize there were some VB functions for this.
I was hoping there was a way for (Command "OpenDCL") to return something to let you know it failed.  But I'll try your code when I get a chance.
The command function always return nil. But if the OpenDCL command fails all ODCL functions will not be available in that CAD session. Checking for that is easy enough.
I turned it into these. Works for me.
Thanks for way to do a registry call

(defun c:opendclcheck ()
    (if (vl-registry-read (strcat "HKEY_LOCAL_MACHINE\\"
                                  (vlax-product-key)
                                  "\\Applications\\OpenDCL\\Commands"
                          )
                          "OPENDCL"
        )
        (princ "ok")
        (princ "not ok")
    )
)