Get Files Dialog

Function Syntax (LM:getfiles <msg> <def> <ext>)
Current Version 1.6
Download GetFilesV1-6.lsp
View HTML Version GetFilesV1-6.html
Donate
Arguments
Symbol Type Description
msg String Dialog box label; 'Select Files' is displayed if nil or ""
def String Default directory; DWGPREFIX is used if nil or ""
ext String File extension filter (e.g. "dwg;lsp"); "*" is assumed if nil or ""
Returns
Type Description
List List of selected files, else nil if Cancel was pressed

Function Description

This function is analogous to the AutoLISP getfiled function, however allows the user to select multiple files from several directories.

The user may select a directory using either the Browse button at the top of the dialog, or by entering a folder path into the Folder edit box; then proceed to browse the files and folders within that directory from the left-hand list pane.

The folder structure may be navigated from within the left-hand list pane by double-clicking on a listed folder, or on the parent folder symbol (..).

Files may be added to the right-hand list pane by double-clicking on a file, or by selecting multiple files and clicking the Add Files button. Similarly, files may be removed from the right-hand list pane by double-clicking on a file or by selecting a group of files and clicking the Remove Files button.

Files in the right-hand list pane are displayed using a relative path, relative to the directory that is currently selected in the left-hand list pane.

Notes on Parameters

The parameters for this function are identical to those of the AutoLISP getfiled function, minus the bit-coded parameter.

msg

The msg parameter specifies the dialog box label, i.e. the message that is displayed in the dialog title bar; if this parameter is nil or a null string ("") is supplied, the title will default to "Select Files".

def

The def parameter specifies the default directory to be displayed in the left-hand list box when the dialog first appears; if either the supplied directory path does not exist, the parameter is nil, or a null string is given (""), the current directory (DWGPREFIX) will be used.

ext

The ext parameter is a file extension filter specifying which files are to be displayed alongside folders in the left-hand list pane. As per the getfiled function, this parameter will accept wildcard patterns and multiple extensions are separated by a semi-colon (e.g. "dwg;lsp" would display both .dwg and .lsp files). If this parameter is nil or a null string ("") is supplied, "*" will be assumed and the function will display all files.

Demonstration

GetFiles.gif

Example Program

Select all
(defun c:test nil
    (mapcar 'print (LM:getfiles "Select Drawings" "" "dwg"))
    (princ)
)
(vl-load-com) (princ)

textsize

increase · reset · decrease

Designed & Created by Lee Mac © 2010