See the top rated post in this thread. Click here

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

Thread: Open Windows Explorer from within AutoCAD

  1. #1
    Active Member
    Join Date
    2010-05
    Posts
    94
    Login to Give a bone
    0

    Default Open Windows Explorer from within AutoCAD

    i am trying to make a macro to open a windows file explorer window.. i can get it to open to the basic my documents folder (^C^C(startapp "explorer" (strcat "/n,/e," (getvar "dwgprefix")));


    but i want it to open to a specific directory, "c:\temp".. ive tried this macro but it stops at c:, nothing happens

    ^C^C(startapp "explorer" (strcat "/n,/e, /select, C:\temp" (getvar "dwgprefix")));

    can someone reply back w/ a working macro please

    also, if i could get it to show only .DWG files, that would be even better

    thank you!

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,803
    Login to Give a bone
    0

    Default Re: Open Windows Explorer from within AutoCAD

    This works for me.

    Code:
    (STARTAPP (strcat "EXPLORER /e," "C:\\Temp"))
    I'm not sure how you would initiate a "search" for .DWG files - which is the only way to "filter" that I'm aware of.
    EDIT: Maybe this would help with the filtering.
    Last edited by rkmcswain; 2015-06-17 at 12:01 PM. Reason: add link
    R.K. McSwain | CAD Panacea |

  3. #3
    Active Member
    Join Date
    2010-05
    Posts
    94
    Login to Give a bone
    0

    Default Re: Open Windows Explorer from within AutoCAD

    rkmcswain, thanks for the replying..

    i tried the (STARTAPP (strcat "EXPLORER /e," "C:\\Temp")) you wrote.. a window doesnt open/nothing happens.. when i look at the command line it stops at c:

    i removed the \\ and wrote.. ^C^C(STARTAPP (strcat "EXPLORER /e," "C:Temp")) this did open the window, but to the base my documents directory, not the temp directory

    any other suggestions?

    thanks again!

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

    Default Re: Open Windows Explorer from within AutoCAD

    Just as a test, copy and paste my code to the AutoCAD command line. Does it run correctly there?
    R.K. McSwain | CAD Panacea |

  5. #5
    Active Member
    Join Date
    2010-05
    Posts
    94
    Login to Give a bone
    0

    Default Re: Open Windows Explorer from within AutoCAD

    whoa.. yes, it does.. right to the correct directory

    interesting, it works at the command line but not as a macro on a drop down menu. huh

  6. #6
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,803
    Login to Give a bone
    0

    Default Re: Open Windows Explorer from within AutoCAD

    Okay, slashes in macros do interesting things, so let's remove them from the equation.

    For your menu macro, use this:

    Code:
    ^c^c(my_temp);
    Then whatever the name of this menu is, find the corresponding MNL file. The file name will be <menuname>.mnl (regardless whether it's your own custom menu or the stock menu from AutoCAD - although I suggest using your own custom menu)
    So for example if your menu is named "Company.cuix", then the MNL file we need will be named "Company.mnl".
    If that file does not exist, create it using Notepad.
    In that file add this lisp code

    Code:
    (defun my_temp ()
      (startapp (strcat "Explorer /e," "c:\\temp"))
    )
    MNL files are loaded automatically when a menu file with the same name is loaded.

    I have tested this here and it works.
    R.K. McSwain | CAD Panacea |

  7. #7
    Active Member
    Join Date
    2010-05
    Posts
    94
    Login to Give a bone
    0

    Default Re: Open Windows Explorer from within AutoCAD

    duh, write a lisp for it.. i added it to my startup list routine.. it worked!

    any suggestions for it to show dwg files only? if not, its no biggie, i can work with this

    thanks!

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

    Default Re: Open Windows Explorer from within AutoCAD

    Sounds like you already know this... but for other readers.... this method lets you test the lisp code independent of the CUI, so you don't have to mess with repeated menu macro editing.
    And you can call the function from other places than just the menu (such as tool palettes, command line, and other lisp routines)
    R.K. McSwain | CAD Panacea |

  9. #9
    Active Member
    Join Date
    2010-05
    Posts
    94
    Login to Give a bone
    0

    Default Re: Open Windows Explorer from within AutoCAD

    rkmcswain, that is great knowledge to have w/ using the lisp and creating a command and putting command on the tool/menu..

    i came from cad 2012 with a very customized system. i decided to learn the CUI and it is a HUGE improvement over writing the code/lisp in the menu files.. there are some things i find that still are quicker than the new ribbon/icon driven autocad.. but that is another post at another time

    thank you for the help

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

    Default Re: Open Windows Explorer from within AutoCAD

    Two more options.
    Use the lisp CHR function in macros to add characters.
    Code:
    (startapp "explorer" (strcat (chr 47) "n," (chr 47) "e, " (chr 47) "select, C:\\temp"))
    works the same in a macro as it does at the command line.

    Use Lee Mac's Open.lsp: http://www.lee-mac.com/open.html

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 5
    Last Post: 2015-07-22, 10:55 PM
  2. Missing AutoCad icons in Windows Explorer
    By dflores.83105 in forum AutoCAD General
    Replies: 4
    Last Post: 2012-11-09, 01:25 PM
  3. Open from Windows Explorer ignores profile
    By CAtDiva in forum AutoCAD General
    Replies: 3
    Last Post: 2010-04-06, 04:11 PM
  4. Replies: 4
    Last Post: 2008-01-21, 01:21 PM
  5. Replies: 5
    Last Post: 2006-10-09, 09:25 PM

Posting Permissions

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