Rhino.UI.OpenFileDialog.ShowOpenDialog with MultiSelect=True not working

The code below is from Rhino IronPython Help and userinterface.py (V6), with ShowOpenDialog in place of ShowDialog in the latter.

When the script is run in V5, multiple files can be selected and fd.FileNames contains all the paths and file names.
When run in V6, only a single file can be selected, but fd.FileNames contains an empty array.

Thank you,
Steve

import Rhino
import rhinoscriptsyntax as rs

def openFileNames(title=None, filter=None, folder=None, filename=None, extension=None):
    fd = Rhino.UI.OpenFileDialog()
    if title: fd.Title = title
    if filter: fd.Filter = filter
    if folder: fd.InitialDirectory = folder
    if filename: fd.FileName = filename
    if extension: fd.DefaultExt = extension
    fd.MultiSelect = True
    if fd.ShowOpenDialog(): return fd.FileNames
    return []

filenames = openFileNames("Open", "Text Files (*.txt)|*.txt|All Files (*.*)|*.*||")

for filename in filenames: print filename

@spb, that fails here too. Small workaround until this gets attention is to use OpenFileDialog under Windows. Below works in V5 and V6:

from System.Windows.Forms import OpenFileDialog, DialogResult
    
def DoSomething():
    fd = OpenFileDialog()
    fd.Multiselect = True
    fd.RestoreDirectory = True
    fd.Title = "Open"
    fd.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
    if fd.ShowDialog() == DialogResult.OK:
        for filename in fd.FileNames:
            print filename
    
DoSomething()

c.

Yep, I see it. I’ve added it to the pile.

https://mcneel.myjetbrains.com/youtrack/issue/RH-37371

– Dale

This will be fixed in SR5.

RH-37371 is fixed in the latest Service Release Candidate