TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: CatDance on September 08, 2021, 02:27:07 AM

Title: how to check current running lisp is loaded from which drive and folder ?
Post by: CatDance on September 08, 2021, 02:27:07 AM
Example if I loaded a lisp using appload to load it,

when that lisp is running, how to check where it is loaded from ?

Thanks.
Title: Re: how to check current running lisp is loaded from which drive and folder ?
Post by: baitang36 on September 08, 2021, 07:34:57 AM
(defun c:tt ()
  (setq
          nice_path (vl-registry-read
                        (strcat "HKEY_CURRENT_USER\"
                                (vlax-product-key)
                                "\\Profiles\"
                                (vla-get-activeprofile (vla-get-profiles (vla-get-preferences (vlax-get-acad-object))))
                                "\\Dialogs\\Appload"
                        )
                        "MainDialog"
    )
                nice_path (strcat nice_path ";" nice_path "nice\\support")
        )
)
Title: Re: how to check current running lisp is loaded from which drive and folder ?
Post by: baitang36 on September 08, 2021, 07:43:11 AM
(defun GetLspPath()
  (setq lsppath
     (vl-registry-read
"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\OpenSaveMRU\\lsp"
(substr
   (vl-registry-read
     "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\OpenSaveMRU\\lsp"
     "MRUList"
   )
   1
   1
)
     )
  )
  (setenv "ACAD" (strcat (getenv "ACAD") ";" (vl-filename-directory lsppath)))
)
Title: Re: how to check current running lisp is loaded from which drive and folder ?
Post by: Grrr1337 on September 14, 2021, 04:01:02 AM
I've examined baitang36's code and this seems to work for finding the directory's path:

Code - Auto/Visual Lisp: [Select]
  1. ; (GetLastApploadedLispPath)
  2. (defun GetLastApploadedLispPath ( )
  3.   (vl-registry-read
  4.     (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\"
  5.       "\\Dialogs\\Appload"
  6.     ); strcat
  7.     "MainDialog"
  8.   ); vl-registry-read
  9. ); defun
Code - Auto/Visual Lisp: [Select]
  1. _$ (GetLastApploadedLispPath)
  2. "D:\\CODE STUFF\\LISP\\Potentially USED LISPs\\Curves\\"


But unfortunately I don't have "MRUList" registry, but "MRUListEx" instead, hence:
Code - Auto/Visual Lisp: [Select]
  1. _$ (vl-registry-read
  2.   "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\OpenSavePidlMRU\\lsp"
  3.   "MRUListEx"
  4. )
  5. >>
  6. (3)

and
Code - Auto/Visual Lisp: [Select]
  1. _$ (vl-registry-read
  2.     "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\OpenSaveMRU\\lsp"
  3.     (itoa
  4.       (car
  5.         (vl-registry-read
  6.           "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\OpenSavePidlMRU\\lsp"
  7.           "MRUListEx"
  8.         )
  9.       )
  10.     )
  11.   )
  12. >> nil

Doesn't seem to work.