OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: EricStiles on May 05, 2019, 07:26:05 PM

Title: Check to see if OpenDCL has been installed.
Post by: EricStiles on May 05, 2019, 07:26:05 PM
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?
Title: Re: Check to see if OpenDCL has been installed.
Post by: Fred Tomke on May 05, 2019, 09:13:56 PM
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<ReleaseNumber>\ACAD-<ReleaseKey>\Applications\OpenDCL\Commands exists and the files "C:\Program Files (x86)\Common Files\OpenDCL\OpenDCL.x64.<ReleaseNumber>.arx" exist.

Regards, Fred
Title: Re: Check to see if OpenDCL has been installed.
Post by: roy_043 on May 05, 2019, 11:24:40 PM
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.
Title: Re: Check to see if OpenDCL has been installed.
Post by: EricStiles on May 06, 2019, 06:19:05 PM
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.
Title: Re: Check to see if OpenDCL has been installed.
Post by: roy_043 on May 07, 2019, 12:36:15 AM
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.
Title: Re: Check to see if OpenDCL has been installed.
Post by: hanslammerts on June 16, 2019, 01:33:39 PM
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")
    )
)