Site Tools

Selecting Multiple Files


Summary: Demonstrates how to use RhinoScript's MultiListBox function to select multiple files.

The following example RhinoScript code demonstrates how to use the MultiListBox function to display a list of file names to select.

 Sub Test
   Dim sFolder
   sFolder = Rhino.BrowseForFolder( , "Select folder with 3DM files" )
   If VarType( sFolder ) <> vbString Then Exit Sub
   Dim oFSO
   Set oFSO = CreateObject( "Scripting.FileSystemObject" ) 
   Dim oFolder
   Set oFolder = oFSO.GetFolder( sFolder )
   Dim oFile, aFiles(), nCount
   nCount = 0
   For Each oFile In oFolder.Files
     ReDim Preserve aFiles(nCount)
     aFiles(nCount) = oFile.Name
     nCount = nCount + 1
   If nCount = 0 Then 
     Rhino.Print "Selected folder contained no 3DM files."
     Exit Sub
   End If
   Dim aSelected, sSelected
   aSelected = Rhino.MultiListBox(aFiles, oFolder.Path)
   If IsArray(aSelected) Then
     For Each sSelected In aSelected
       Rhino.Print sSelected
   End If
 End Sub
developer/scriptsamples/multilistbox.txt ยท Last modified: 2020/08/14 (external edit)