opening explorer down dir list

Discussion in 'AutoCAD' started by devon, Jun 23, 2004.

  1. devon

    devon Guest

    Hi,

    You know when you open windows explorer, you can type the 1st few letters of the files in the right hand pane and the scroll bar slides down and highlights the file starting with those letters.

    Well IS there a switch you can use from autocad to goto a particular depth down that folder so you don't have to type those 1st few letters?

    for example, we name all our xrefs XC_name_p1 or XS_name_S1 etc.
    We can end up with 1000's of xrefs and when you have like 200 arxh xrefs labeled XA_name_xx at the top of the dir, you have to scroll down and down and down until you get to the area you want eg XS_xxxx.
    Currently i use this macro to open explorer in the currently opend dwg dir:

    (startapp "explorer" (strcat "/e, "(getvar "dwgprefix")))

    this works from acad, but now i would liketo go one step further so it goes to a given way down the list eg, XM, XC, XS etc

    Is this possible or am i pee'ing in the wind?

    Thanks
    Devon
     
    devon, Jun 23, 2004
    #1
  2. devon

    zeha Guest

    you can used the DOSlib from Robert McNeel & Associates
    Internet: www.mcneel.com


    (dos_getfiled "Select a file" (getvar "dwgprefix") "Drawing files (X*.dwg)|X*.dwg|All files (*.*)|*.*||")

    or Lisp function (not elegant) in combin whit given the filename XM*.dwg

    (getfiled "Select a Drawing" (strcat (getvar"dwgprefix") "dwg" 8)
     
    zeha, Jun 23, 2004
    #2
  3. devon

    devon Guest

    Hi Zeha

    Thanks for the reply.
    We use doslib, but the examples you gave below don't seem to open explorer, just the file open dialogue.

    Is this the only option?
    Also I can't seem toget the bottom eg working, not sure why

    Thanks
    Devon
     
    devon, Jun 24, 2004
    #3
  4. devon

    devon Guest

    Hi again,
    you seem to be a gun on this so I hope you can help me out some more.

    Just playing around some more and this doslib example works well at filtering out what I need.
    1question,

    When i select the drawing to open, it does not open that selected dwg. acad does nothing, not even an error. if i right click and hit open then it opens. but the open button has no effect.
    any idea? winXP, sp1. acad 2005. latest doslib.

    command line:
    (dos_getfiled "Select a file" (getvar "dwgprefix") "Drawing files
    (X_S*.dwg)|X_S*.dwg|All files (*.*)|*.*||")
    "O:\\BRS\\T05 Drawings\\X_S_ECP_REFURB-03.dwg"

    also, can you filter out like 2 groups like XC* & XS* ?

    Thanks
     
    devon, Jun 24, 2004
    #4
  5. devon

    zeha Guest

    This is a way to open drawings with DOSlib
    I have made 3 functions Test1 Test2 and Test3
    Load this example and figure out witch way you wanted

    ;;Test 1 allways opens a new session with the selected drawing
    ;;choose under filetypes for XC or XS
    (defun c:test1 ( / dwgname)
    (vl-load-com)
    (and
    (setq dwgname (dos_getfiled "Select a Drawing file XC or XS" (getvar "dwgprefix") "Drawing files XC*.dwg|XC*.dwg|Drawing files XS*.dwg|XS*.dwg|"))
    (findfile dwgname)
    )
    (startapp (strcat (vla-Get-FullName (vlax-get-acad-object)) " \"" dwgname "\"")))
    )
    ;;Test2 open the drawing selected in the same session if SDI = 1 otherwise it prompted
    ;;The drawing will be saved to the name given at the command line
    ;;choose under filetypes for XC or XS
    (defun c:test2 ( / dwgname)
    (if
    (and
    (setq dwgname (dos_getfiled "Select a Drawing file XC or XS" (getvar "dwgprefix") "Drawing files XC*.dwg|XC*.dwg|Drawing files XS*.dwg|XS*.dwg|"))
    (findfile dwgname)
    )
    (progn
    (setvar "sdi" 1)
    (setvar "cmdecho" 1)
    (if (= (getvar "sdi") 1)
    (if (> (getvar "dbmod") 0)(command "_.save" pause ".open" dwgname)(command ".open" dwgname))
    (alert (strcat "Can't open " dwgname "\nClose all drawings en set variable SDI to 1"))
    )
    )
    )
    )
    ;;Test3 opens a new session if SDI = 0 otherwise it open the drawing selected in the same session
    ;;The current drawing will not!!! be saved
    (defun c:test3 ( / dwgname)
    (vl-load-com)
    (and
    (setq dwgname (dos_getfiled "Select a Drawing file XC or XS" (getvar "dwgprefix") "Drawing files XC*.dwg|XC*.dwg|Drawing files XS*.dwg|XS*.dwg|"))
    (findfile dwgname)
    )
    (progn
    (setvar "sdi" 1)
    (setvar "cmdecho" 1)
    (if (= (getvar "sdi") 1)
    (if (> (getvar "dbmod") 0)(command ".open" "y" dwgname)(command ".open" dwgname))
    (startapp (strcat (vla-Get-FullName (vlax-get-acad-object)) " \"" dwgname "\"")))
    )
    )
    )
     
    zeha, Jun 24, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.