Jump to content

Recommended Posts

Posted

How to open and close a Folder by visual lisp?

I have a Path (ex:"D:\\PROJECTS\2010\")

Posted
How to open and close a Folder by visual lisp?

I have a Path (ex:"D:\\PROJECTS\2010\")

 

One way is

 
(defun openw (fldr)
(startapp "explorer" fldr)
 )

 

(openw "D:\\PROJECTS\2010")

Posted (edited)

Thanks.

Lee helped me

(defun Explore ( Directory / Shell result )
 (setq Shell  (vla-getInterfaceObject (vlax-get-acad-object) "Shell.Application"))
 (setq result (vl-catch-all-apply 'vlax-invoke (list Shell 'Explore Directory)))
 (vlax-release-object Shell)
 (not (vl-catch-all-error-p result))
)

But I still can't Close a Folder :(

Edited by SLW210
Tags!
Posted (edited)

this may help

;;;CADALYST 10/06   Tip2158: Directory.lsp   Directory   (c) Mark Newman 

;;; Created by Mark Newman : June 2002
;;;
;;  ----
;;  ----
(DEFUN C:DIRECTORY (/)
 (STARTAPP "EXPLORER" (GETVAR "DWGPREFIX"))
 (PRINC)
)
;;  ----
;;  ----

Edited by SLW210
Tags!
  • 1 year later...
Posted

I have needed a way for our users to open files in a specific folder. Not the last one accessed or the folder where the particular open file originated. Trying to use the Open command did not work so I used "startapp" like this to open Explorer in the T:\ drive which is mapped to a server location:

 

^C^C^P(startapp "Explorer T:")

 

This works but I'd like to have only the *.dwg file appear in the list and adding \*.dwg to the above command has no affect on it.

Posted

Lee,

 

Thanks. I had to double check my syntax, but that is working. Thanks again.

 

BTW - are you getting to see any of the Olympic Games over there?

Posted
BTW - are you getting to see any of the Olympic Games over there?

 

I certainly am! Some fantastic talent on show, absolutely enthralling to watch :)

Posted

Especially the Netherlands Women's Field Hockey team. Hubba hubba!

 

To complete this here is what I ended up doing:

 

(defun c:open4chk (/ fname)
 (vl-load-com)
 (setq fname (getfiled "" "T:/" "dwg" 16))
 (vla-activate (vla-open (vla-get-documents (vlax-get-acad-object)) fname))
)

 

Works pretty good. Thanks again.

Posted

Indeed, or the beach volleyball! ;)

 

Alternatively, consider:

 

(defun c:open4chk ( / f )
   (if (setq f (getfiled "" "T:/" "dwg" 16))
       (startapp "explorer" f)
   )
   (princ)
)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...