Author Topic: Check to see if OpenDCL has been installed.  (Read 307 times)

EricStiles

  • Member
  • *
  • Posts: 16
Check to see if OpenDCL has been installed.
« 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?

Fred Tomke

  • OpenDCL Technician
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2058
  • [ Mr. Bad Guy ]
    • Kommunale Entwicklungsplanung auf digitaler Basis - digital landscape and urban design
Re: Check to see if OpenDCL has been installed.
« Reply #1 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
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

roy_043

  • Sr. Member
  • ****
  • Posts: 361
Re: Check to see if OpenDCL has been installed.
« Reply #2 on: May 05, 2019, 11:24:40 PM »
The first part of Tom's suggestion can look like this (tested on BricsCAD):
Code: [Select]
; (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.

EricStiles

  • Member
  • *
  • Posts: 16
Re: Check to see if OpenDCL has been installed.
« Reply #3 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.

roy_043

  • Sr. Member
  • ****
  • Posts: 361
Re: Check to see if OpenDCL has been installed.
« Reply #4 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.

hanslammerts

  • Member
  • *
  • Posts: 38
Re: Check to see if OpenDCL has been installed.
« Reply #5 on: June 16, 2019, 01:33:39 PM »
I turned it into these. Works for me.
Thanks for way to do a registry call

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