+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Junior Member nataca's Avatar
    Using
    AutoCAD 2009
    Join Date
    Mar 2008
    Location
    HaLong/VietNam
    Posts
    14

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

    Registered forum members do not see this ad.

    How to open and close a Folder by visual lisp?
    I have a Path (ex:"D:\\PROJECTS\2010\")

  2. #2
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,106

    Default

    Quote Originally Posted by nataca View Post
    How to open and close a Folder by visual lisp?
    I have a Path (ex:"D:\\PROJECTS\2010\")
    One way is
    Code:
     
    (defun openw (fldr)
    (startapp "explorer" fldr)
      )
    (openw "D:\\PROJECTS\2010")

  3. #3
    Junior Member nataca's Avatar
    Using
    AutoCAD 2009
    Join Date
    Mar 2008
    Location
    HaLong/VietNam
    Posts
    14

    Default

    Thanks.
    Lee helped me
    Code:
    (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
    Last edited by SLW210; 31st Jul 2012 at 09:00 pm. Reason: Tags!

  4. #4
    Junior Member
    Computer Details
    Ace's Computer Details
    Operating System:
    windows 7
    Discipline
    See details...
    Ace's Discipline Details
    Occupation
    CAD Developer, security & tellecommunications
    Discipline
    See details below.
    Details
    Design & development of security & tellecommunications systems for clients within residential & commercial industries. Working with ACAD 2012 creating detailed floor plans, elevations, sketches, point to points, risers etc.
    Using
    AutoCAD 2012
    Join Date
    Apr 2010
    Location
    New York City
    Posts
    19

    Default

    this may help
    Code:
    ;;;CADALYST 10/06   Tip2158: Directory.lsp   Directory   (c) Mark Newman 
     
    ;;; Created by Mark Newman : June 2002
    ;;;
    ;;  ----
    ;;  ----
    (DEFUN C:DIRECTORY (/)
      (STARTAPP "EXPLORER" (GETVAR "DWGPREFIX"))
      (PRINC)
    )
    ;;  ----
    ;;  ----
    Last edited by SLW210; 31st Jul 2012 at 08:59 pm. Reason: Tags!

  5. #5
    Super Member Bill Tillman's Avatar
    Using
    AutoCAD 2013
    Join Date
    Oct 2008
    Location
    Miami, FL
    Posts
    870

    Default Filter which files appear in Explorer

    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:

    Code:
    ^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.
    It's deja vu, all over again.

  6. #6
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,729

    Default

    Code:
    (getfiled "" "T:\\" "dwg" 16)
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  7. #7
    Super Member Bill Tillman's Avatar
    Using
    AutoCAD 2013
    Join Date
    Oct 2008
    Location
    Miami, FL
    Posts
    870

    Default

    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?
    It's deja vu, all over again.

  8. #8
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,729

    Default

    Quote Originally Posted by Bill Tillman View Post
    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
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  9. #9
    Super Member Bill Tillman's Avatar
    Using
    AutoCAD 2013
    Join Date
    Oct 2008
    Location
    Miami, FL
    Posts
    870

    Default

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

    To complete this here is what I ended up doing:

    Code:
    (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.
    It's deja vu, all over again.

  10. #10
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,729

    Default

    Registered forum members do not see this ad.

    Indeed, or the beach volleyball!

    Alternatively, consider:

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

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

Similar Threads

  1. Open and send email using visual lisp
    By Small Fish in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 15th Jul 2011, 03:28 pm
  2. When open a file a lisp created in the same folder
    By asos2000 in forum AutoLISP, Visual LISP & DCL
    Replies: 21
    Last Post: 16th Jun 2011, 11:07 am
  3. Open to a Specific Folder
    By MFish in forum AutoLISP, Visual LISP & DCL
    Replies: 20
    Last Post: 2nd Jun 2010, 06:57 pm
  4. Close or open?
    By homer in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 11th May 2007, 01:02 pm
  5. Open dwg. folder
    By windseaker in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 1st Nov 2005, 10:29 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts