Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Mentor
aqdam1978
Posts: 265
Registered: ‎11-05-2008
Message 1 of 3 (254 Views)
Accepted Solution

BrowseForFolder

254 Views, 2 Replies
02-02-2013 09:01 AM

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
)

 

 

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

 

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

Distinguished Mentor
_Tharwat
Posts: 612
Registered: ‎07-02-2010
Message 2 of 3 (252 Views)

Re: BrowseForFolder

02-02-2013 09:09 AM 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 )
____________________________________________________
Get learn and learn and practice , to become experienced guy .
*Expert Elite*
Kent1Cooper
Posts: 5,513
Registered: ‎09-13-2004
Message 3 of 3 (245 Views)

Re: BrowseForFolder

02-02-2013 09:37 AM 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
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.