Jump to content

Recent Files List


Steven P

Recommended Posts

Hi,

If you are referring to drawings with the word files then the answer is yes.

eg:

(vlax-for doc (vla-get-documents (vlax-get-acad-object))
  (princ (strcat "\n" (vla-get-name doc))))

 

Link to comment
Share on other sites

Whoops, I should have said, drawing DWG files

 

Thanks Tharwat - that gives me the most recently opened and still opened file (so if I open a file and close it, it will give the file before that which is still open) - that is quite useful but not what I was after today

 

What I was after really (my fault, I didn't explain well enough) was a list of maybe the last 5 or so drawing (dwg) files that I saved similar to the 'recent files list' you get in the 'Files' menu

 

 

I have a little batch routine (not quite in a state to share it but I am working on it) and thought it would be good to add a button along the lines of "do this to the last 5 drawings" - useful for example to plot a mornings work with one button.

 

I am thinking that if I can get a list of recent drawings, then I should be able to get their properties and saved time / date, filter or sort the list to return just todays (or whenever) to do my batch process.

 

 

Thanks for your help so far - always appreciated

Link to comment
Share on other sites

Try this. Rediscovered when transfering lisps. Reads the relevant registry keys.

 

;; BlackBox/Renderman
(defun RecentFiles  ()
  (vl-load-com)
  ((lambda (key i / val values)
     (while
       (/= nil
           (setq val (vl-registry-read
                       key
                       (strcat "File" (rtos (setq i (1+ i)) 2 0)))))
        (setq values (cons val values)))
     (reverse values))
    (strcat "HKEY_CURRENT_USER\\"
            (vlax-product-key)
            "\\Recent File List\\")
    0)
)

 

It is a function so call it using (recentfiles). Not sure if it will work on BricsCAD but could be adapted

Link to comment
Share on other sites

The following will return a list of the last 50 drawings opened, sorted with the most recently opened drawing first:

(defun LM:recentfiles ( )
    (
        (lambda ( reg )
            (mapcar 'car
                (vl-sort
                    (mapcar
                       '(lambda ( x )
                            (cons
                                (vl-registry-read reg x)
                                (atoi (vl-registry-read reg (strcat "filetime" (substr x 5))))
                            )
                        )
                        (vl-remove-if-not
                           '(lambda ( x ) (wcmatch (strcase x t) "file#*"))
                            (vl-registry-descendents reg "")
                        )
                    )
                   '(lambda ( a b ) (> (cdr a) (cdr b)))
                )
            )
        )
        (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Recent File List")
    )
)

 

  • Like 1
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...