Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Star Lounger
    Join Date
    Apr 2001
    Location
    Washington, Washington, USA
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Capturing TREE Command (Office 2000)

    This isn't exactly a VBA question, but I wasn't sure where else to ask. I'm trying to capture to a file the results of the DOS "Tree" command. I'm able to easily save the file (Tree c:Folder > Temp.txt), but the lines that make up the "tree" convert to the characters below:
    C:.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Capturing TREE Command (Office 2000)

    If you want a graphical display, you could find-and-replace those characters with the "line drawing" characters they were meant to be. It would be easiest in Word... On the other hand, if you just want a list, you could use a different approach, such as:

    dir /ad /s /b > dir_dirs.txt

    which in your example should give you a list similar to:

    C:Top Folder
    C:Top FolderSecond Level Subfolder 1
    C:Top FolderSecond Level Subfolder 2
    C:Top FolderSecond Level Subfolder 2Third Level Subfolder 1
    C:Top FolderSecond Level Subfolder 2Third Level Subfolder 2

  3. #3
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Capturing TREE Command (Office 2000)

    I've tried your first approach before Jefferson, and couldn't get it to work. For instance, using Terminal font, I've tried to display the character 0192 in Word, and instead of looking like <big>|_</big> it appears as

  4. #4
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Capturing TREE Command (Office 2000)

    Hi Karyl

    This is something that has irked me for some time. MS seems to have given up (direct) support for certain kinds of font characters. In Word, it appears that it's possible to reclaim this feature by jumping through a series of hoops:

    "To access the line drawing characters that were formerly available in MS LineDraw, click Symbol on the Insert menu, change the font to (normal text), and change the Subset to Box Drawing."

    I tried this and was able to extract these symbols:

  5. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Capturing TREE Command (Office 2000)

    I recently did something similar using dir /s /-p > DriveLetter.txt.

    And then constructed a Word macro to extract the file types and size of files into a table.

    I guess that one could follow the same methodology to build a tree.

  6. #6
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Capturing TREE Command (Office 2000)

    Hi Karyl,

    A suggested solution, using Word:
    1. Replace
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  7. #7
    Star Lounger
    Join Date
    Apr 2001
    Location
    Washington, Washington, USA
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Capturing TREE Command (Office 2000)

    Thanks for all the input. I didn't even make it to my desk today, so I didn't get a chance to play with any of the suggestions. But I'm hoping to do so tomorrow. I'll let you know how it works out.

    Using the "Tree" command was sort of a "what the heck" attempt at trying to find an easy way to do this, since it is a low-priority feature, therefore not worthy of much time while other pressing concerns need addressing, but it is something I'd like to include in this project. I was reading an article from the MSKB explaining how to create a batch file to print a directory listing that you could then add to the right click menu in Explorer, and while I was playing around with setting it up (I was intrigued by the idea of adding a right-click menu item to a "Folder" file type), I had one of those glimmers of memory that ended with the Tree command floating to the surface. So I gave it a try, and, low and behold, it worked! I was on a Windows 2000 system then, but I was using it on my XP system at home last night, and it worked there, too. So I didn't have to find it, it was just there.

    By the way, I wasn't too impressed with the results of the KB article's method, although making something that worked on a folder was cool. I hadn't realized that "Folder" was even an entry in the File Types list.

    Again, many thanks!

    ADDED: I forgot to say that doing a screen capture directly from the DOS command prompt window and pasting it into Word has the same result and sending the output directly to a file.

    --Karyl

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Capturing TREE Command (Office 2000)

    You might also investigate the free utility Karen's Directory Printer. It allows you to print the contents of a folder or to save the contents to a file, and it has options to add itself to the right-click menu for a folder.

  9. #9
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Capturing TREE Command (Office 2000)

    Just as a follow-up to this, here's a macro that carries out these replacements across a selection. There's no doubt some redundant stuff in it, but I think it works OK and besides... I've wanted this for some time myself <img src=/S/grin.gif border=0 alt=grin width=15 height=15>. I seem to recall someone mentioning a way of entering codes like ChrW(9500) directly into the Find/Replace dialog. Or did I dream it again?

    Alan

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Capturing TREE Command (Office 2000)

    In Word XP, you can type a hexadecimal number followed by Alt+X to generate a Unicode character. This works in a document and also in the Find/Replace dialog.

  11. #11
    Star Lounger
    Join Date
    Apr 2001
    Location
    Washington, Washington, USA
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Capturing TREE Command (Office 2000)

    Well, I was plugging right along. My macro was working, inserting the output from the Tree command, doing the search and replace (of course, I had it done already before I saw your code snippet--thanks, anyway!). And then it suddenly started bringing in the text as Japanese (Shift-JIS). And the replacement characters for the Line Draw characters were all different. HOWEVER, as I was stepping through the macro trying to figure out what the heck was going on, I discovered that if I just did a File/Open with Confirm Conversions turned on, I was able to select the "Western European (DOS)" filer, and it all came in a pretty as you could want and no

  12. #12
    Star Lounger
    Join Date
    Apr 2001
    Location
    Washington, Washington, USA
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Capturing TREE Command (Office 2000)

    Here's the [almost] finished product. I'm going to use a Treeview control to allow them to choose a folder rather than type it in, but that can wait for now. I never found the constant for specifying the "Western European (DOS)" encoding filter, so the search/replace routine is still there. Also included is some nifty code I found at VBnet to pause the macro until the Shell command if finished.

    It's not nearly as slick as Karen's Directory Printer (www.karenware.com/powertools/ptdirprn.asp), but it get's done what I need.

    Thanks for all your help!

    --Karyl

  13. #13
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Capturing TREE Command (Office 2000)

    Unfortunately, all I get is the error shown. The macro defaults to E:My Documents, but I get this error message regardless of what I specify.

    Alan

  14. #14
    Star Lounger
    Join Date
    Apr 2001
    Location
    Washington, Washington, USA
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Capturing TREE Command (Office 2000)

    I just tried it on my system at home, and I get an error, too, although a different one. It may have something to do with Windows and/or Word versions. The system where it works just fine is set up with both Windows and Word 2000. I've got both XP's at home. Can you let me know what you've got? I sent it out late today for the word processing supervisor to try for me; she is also on an XP system. I'll find out next week what her results were, but I suspect the same type of thing. Back to the drawing board!

    --Karyl

  15. #15
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Capturing TREE Command (Office 2000)

    <hr>Can you let me know what you've got?<hr>Easy! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

Page 1 of 2 12 LastLast

Posting Permissions

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