Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

BrowseForFolder

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
aqdam1978
1032 Views, 2 Replies

BrowseForFolder

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
)

 

 

2 REPLIES 2
Message 2 of 3
_Tharwat
in reply to: aqdam1978

Just remove the c: from the first line of the code and try again .

 

(defun C:DirectoryDialog ( msg dir flag / Shell Fold Self Path )
Message 3 of 3
Kent1Cooper
in reply to: aqdam1978

... and move one of the parentheses one word to the left:

 

(setq fldr (directorydialog "Please select a folder" "" 65536))

Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost