See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Lisp to open a file folder

  1. #1
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    403
    Login to Give a bone
    0

    Default Lisp to open a file folder

    Hi everyone,

    I need help on a lisp that will open a file folder on my network, I tried to write one but when the code is run it opens the Documents folder. Not sure how to fix it.

    Code:
    (defun c:ZOF24x36 ()
       (startapp "explorer" "C:\\VDG Dropbox\\03 - C A D  Defaults\\03.01-Blocks\\03.01.04-CDs\\03.01.04.06-Details\\03.03.04.01-VDG_24x36")
    )
    Thanks for the help.

    Cadd4la

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,685
    Login to Give a bone
    1

    Default Re: Lisp to open a file folder

    This Lee Mac function should work: http://www.lee-mac.com/explore.html
    Load it and try:
    Code:
    (LM:explore "C:\\VDG Dropbox\\03 - C A D  Defaults\\03.01-Blocks\\03.01.04-CDs\\03.01.04.06-Details\\03.03.04.01-VDG_24x36")

  3. #3
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,145
    Login to Give a bone
    1

    Default Re: Lisp to open a file folder

    Quote Originally Posted by cadd4la View Post
    Hi everyone,

    I need help on a lisp that will open a file folder on my network, I tried to write one but when the code is run it opens the Documents folder. Not sure how to fix it.

    Code:
    (defun c:ZOF24x36 ()
       (startapp "explorer" "C:\\VDG Dropbox\\03 - C A D  Defaults\\03.01-Blocks\\03.01.04-CDs\\03.01.04.06-Details\\03.03.04.01-VDG_24x36")
    )
    Thanks for the help.

    Cadd4la
    The issue is the spaces in your file path. You would need to encapsulate the file path within an additional set of quotes.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  4. #4
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,821
    Login to Give a bone
    1

    Default Re: Lisp to open a file folder

    I created your path as a test, and your code works fine for me.

    AutoCAD 2023, Windows 10.

    R.K. McSwain | CAD Panacea |

  5. #5
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    403
    Login to Give a bone
    0

    Default Re: Lisp to open a file folder

    Tom,

    Thanks for your reply, Unfortunately, the code doesn't work. This is what I get when I run it
    Command: (LOAD "C:/Verde Dropbox/04 - C A D Custom Files/OpenFolder.LSP") ; error: no function definition: LM:EXPLORE
    Cadd4la

  6. #6
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    403
    Login to Give a bone
    0

    Default Re: Lisp to open a file folder

    Opie,

    Thanks for your help, not sure where to add the additional set of quotes.

    Cadd4la

  7. #7
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    403
    Login to Give a bone
    0

    Default Re: Lisp to open a file folder

    R.K.,

    Thank you for your reply. my code still won't work for me.

    Cadd4la

  8. #8
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,685
    Login to Give a bone
    0

    Default Re: Lisp to open a file folder

    Quote Originally Posted by cadd4la View Post
    Tom,

    Thanks for your reply, Unfortunately, the code doesn't work. This is what I get when I run it
    Command: (LOAD "C:/Verde Dropbox/04 - C A D Custom Files/OpenFolder.LSP") ; error: no function definition: LM:EXPLORE
    Cadd4la
    Guessing you saved "OpenFolder.LSP" to that folder you problem seems to be accessing that folder.
    Assuming that folder is online accessing those files and folders can be slow and glitchy depending on how your network is setup.
    Mirroring a copy of those files locally and accessing them from there may be a possible solution for both loading the lisp and accessing the file folder.

  9. #9
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,521
    Login to Give a bone
    1

    Default Re: Lisp to open a file folder

    Quote Originally Posted by cadd4la View Post
    Opie,

    Thanks for your help, not sure where to add the additional set of quotes.

    Cadd4la
    It's just how DOS works. If you have a path like C:\Program Files\, the command line sees the space and thinks that Files is an argument to C:\Program. You have to enclose the entire path in quotes "C:\Program Files". Don't forget that in lisp, you will also need an escape character for the quote inside a quote, ". Thus your code would become:

    Code:
    (defun c:ZOF24x36 ()
       (startapp "explorer" "\"C:\\VDG Dropbox\\03 - C A D  Defaults\\03.01-Blocks\\03.01.04-CDs\\03.01.04.06-Details\\03.03.04.01-VDG_24x36\"")
    )
    C:> ED WORKING....


    LinkedIn

  10. #10
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,521
    Login to Give a bone
    0

    Default Re: Lisp to open a file folder

    Quote Originally Posted by cadd4la View Post
    Tom,

    Thanks for your reply, Unfortunately, the code doesn't work. This is what I get when I run it

    Cadd4la
    The function LM:explore hasn't been defined. You failed to load Lee's lisp file. You can load it at startup via acad.lsp or manually load it in this command. Did you download Lee's command from the link Tom posted in post 2? Copy the lisp from the link and save it to your acad.lsp file. Or save it to explore.lsp and in your zof function, use (load "explore.lsp").

    Code:
    ;; Explore  -  Lee Mac
    ;; Opens a specified folder in a Windows Explorer window.
    ;; target - [int/str] Directory or ShellSpecialFolderConstants enum
    
    (defun LM:explore ( target / rtn shl )
        (if (and (or (= 'int (type target)) (vl-file-directory-p target))
                 (setq shl (vla-getinterfaceobject (vlax-get-acad-object) "shell.application"))
            )
            (progn
                (setq rtn (vl-catch-all-apply 'vlax-invoke (list shl 'explore target)))
                (vlax-release-object shl)
                (if (vl-catch-all-error-p rtn)
                    (prompt (vl-catch-all-error-message rtn))
                    t
                )
            )
        )
    )
    
    ;;;usage
    (defun c:ZOF24x36 ()
       (LM:explore "C:\\VDG Dropbox\\03 - C A D  Defaults\\03.01-Blocks\\03.01.04-CDs\\03.01.04.06-Details\\03.03.04.01-VDG_24x36")
    )
    Last edited by Ed Jobe; 2024-07-24 at 03:55 PM.
    C:> ED WORKING....


    LinkedIn

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 2015-07-15, 06:38 PM
  2. Replies: 0
    Last Post: 2011-11-03, 07:10 AM
  3. Replies: 0
    Last Post: 2011-05-30, 07:07 AM
  4. Folder naming and allowable characters in folder names
    By fletch97 in forum CAD Management - General
    Replies: 7
    Last Post: 2006-10-26, 06:01 AM
  5. Open File Dialog Folder Addition
    By barathd in forum Revit Architecture - Tips & Tricks
    Replies: 0
    Last Post: 2005-02-07, 04:44 PM

Tags for this Thread

Posting Permissions

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