Recent files list

Hello,
Is it possible to get a list of the Recent Files from the File
menu? I can read the values from the Registry but unfortunately those
values aren’t updated until the program is shut down. I wanted to make a
popup menu that would show the recent files list.

I don’t believe Rhino’s recent file list is available in any API - sorry.

Thanks for the info.

I wrote a little C# Plugin that does what I want. It reads the Registry at startup and then tracks the saved files internally.

Hi TJ,

FWIW, ( I’m not sure about the files opened in the current session)
The python script below, I have running at startup, finds the recent files in ‘Rhino.ApplicationSettings.FileSettings.RecentlyOpenedFiles()’

import Rhino
import os
import rhinoscriptsyntax as rs

def OpenFromRecentFolders():
    
    
    
    if rs.DocumentName():
        return
    
    recent_list = Rhino.ApplicationSettings.FileSettings.RecentlyOpenedFiles()

    paths=[]
    for filepath in recent_list:
        if filepath:
            paths.append(os.path.dirname(filepath))
        
    
    short_list = list(set(paths))
    short_list.append('D:\\_WERK')
    
    space = [' ']*len(short_list)
    
    
    short_list = [a for b in zip(short_list,space) for a in b]
    
    
    folder_open = rs.ListBox (short_list, "Select Folder to browse", "Recent Folders")

    

    if folder_open :
        Rhino.ApplicationSettings.FileSettings.WorkingFolder = folder_open
        #os.system('run "'+folder_open+'"')
        rs.Command('!_Open')
        
    
    
if __name__ == "__main__":
    script_name = os.path.basename(os.path.realpath(__file__)).split('.')[0]
    macro = '! _-RunPythonScript "{}"'.format(os.path.realpath(__file__))
    rs.AddAlias(script_name,macro)
    OpenFromRecentFolders()
    

I stand corrected…

Awesome! Thanks for pointing me in the right direction. This is easier than what I originally was doing.

It also looks like it updates the list dynamically as you save files during the session.