;; | ---------------------------------------------------------------------------- ;; | MI_askfile ;; | ---------------------------------------------------------------------------- ;; | Function : Ask for a file name, allow browsing, an enhanced version of ;; | (getfiled) ;; | Argument : ;; | 'fn' - FileName to ask for ;; | 'Str' - String to display ;; | 'pat' - Wildcard Pattern for file name ;; | 'gff' - flag which determines whether to create a new file or not ;; | gff = 0 indicates files should exist ;; | gff = 1 indicates files need not exist, enables new file to ;; | be created ;; | Returns : Returns the selected file ;; | Updated : June 25, 1998 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ---------------------------------------------------------------------------- (defun MI_askfile(fn Str pat gff / More _fn Found) (setq More T Found nil ) (while More (setq _fn (MI_askstrng (strcat Str "(~ for list)") fn)) (if (member _fn (list "?" "~")) (progn (setq _fn (getfiled Str fn pat gff)) (if (= _fn 1) (progn (setq fn (MI_askstrng Str fn)) (if (not (or (ST_fsrch fn "/") (ST_fsrch fn "\\") (ST_fsrch fn ":"))) (setq fn (strcat (getvar "DWGPREFIX") fn)) ) ) (setq fn _fn) ) (setq More nil) ) (progn (setq fn _fn More nil ) (if (not (or (ST_fsrch fn "/") (ST_fsrch fn "\\") (ST_fsrch fn ":"))) (setq fn (strcat (getvar "DWGPREFIX") fn)) ) (if (= gff 0) (progn (if (not (equal pat "*")) (progn (setq fn (MI_RemExt fn) fn (strcat fn "." pat) ) (if (findfile fn) (setq Found T) ) ) (progn (if (findfile fn) (setq Found T) ) )) (if (not Found) (progn (princ (strcat "\nCannot find the file : " fn)) (setq fn (MI_askfile fn Str pat gff)) )) )) )) ) fn )