Jump to content

how to refresh the registry of recentfiles?


exceed

Recommended Posts

; GETALLPIN - 2024.09.24 exceeds
;
; Prints a list of documents that the user has pinned in AutoCAD to the command prompt.
; Prints all previous versions of AutoCAD that have been installed and have not been deleted from the registry.
;
; The part that updates the current version in the last part will not be executed.
; because there is a problem in that it returns to its original state when the program ends.
; So I modified it to display the path at the prompt.

(defun c:GETALLPIN ( / versionlist pathlist path0 path1 path2 fn fnlist a b c pinned i fulllist )
  (vl-load-com)
  (setq path0 "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\")
  (setq versionlist (reverse (vl-registry-descendents path0)))
  (setq fnlist '())
  (setq fulllist '())
  (foreach a versionlist
    (setq path1 (strcat path0 a "\\"))
    (setq localelist (reverse (vl-registry-descendents path1)))
    (foreach b localelist 
      (setq path2 (strcat path1 b "\\Recent File List\\"))
      (setq i 1)
      (while (setq pinned (vl-registry-read path2 (strcat "FilePinned" (itoa i))))
        (if (= pinned 1)
          (progn
            (setq fn (vl-registry-read path2 (strcat "File" (itoa i))))
            (if (= (member fn fnlist) nil)
              (progn
                (setq fnlist (cons fn fnlist))
                (setq fulllist (cons (list fn (vl-registry-read path2 (strcat "Class" (itoa i))) (vl-registry-read path2 (strcat "FileTime" (itoa i)))) fulllist))
              )
            )
          )
        )
        (setq i (1+ i))
      )
    )
  )
  (setq fulllist (vl-sort fulllist (function (lambda (x1 x2)(> (caddr x1) (caddr x2))))))
  ;(princ fulllist)
  (setq i 1)
  (foreach c fulllist
    (princ (strcat "\n" (car c)))
    ;(setq path4 (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Recent File List\\"))
    ;(vl-registry-write path4 (strcat "File" (itoa i)) (car c))
    ;(vl-registry-write path4 (strcat "Class" (itoa i)) (cadr c))
    ;(vl-registry-write path4 (strcat "FileTime" (itoa i)) (caddr c))
    ;(vl-registry-write path4 (strcat "FilePinned" (itoa i)) 1) 
  )
  (princ)
)

 

This doesn't work. because the current state is overwritten when close the autocad.

how do I fix it? 

Does a command like reinit exist?

Edited by exceed
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...