Hi,
I found a Lisp program for choosing a folder, but it seams there is problem:
I called this program as:
(setq fldr directorydialog ("Please select a folder" "" 65536))
but it does not work!, does anybody know what is the mistake?
(defun C:DirectoryDialog ( msg dir flag / Shell Fold Self Path ) (vl-catch-all-apply (function (lambda ( / ac HWND ) (if (setq Shell (vla-getInterfaceObject (setq ac (vlax-get-acad-object)) "Shell.Application") HWND (vl-catch-all-apply 'vla-get-HWND (list ac)) Fold (vlax-invoke-method Shell 'BrowseForFolder (if (vl-catch-all-error-p HWND) 0 HWND) msg flag dir) ) (setq Self (vlax-get-property Fold 'Self) Path (vlax-get-property Self 'Path) Path (vl-string-right-trim "\\" (vl-string-translate "/" "\\" Path)) ) ) ) ) ) (if Self (vlax-release-object Self)) (if Fold (vlax-release-object Fold)) (if Shell (vlax-release-object Shell)) Path )
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
Just remove the c: from the first line of the code and try again .
(defun C:DirectoryDialog ( msg dir flag / Shell Fold Self Path )
... and move one of the parentheses one word to the left:
(setq fldr (directorydialog "Please select a folder" "" 65536))