Macro to Extract Layer Names

 
  • Here is a Macro to extract layer names.
    When run it will prompt the user to "Hit R to refresh the list"
    Doing this will run the portion of the macro that exports a list of layer names to a file (LayNames.TXT). Hitting any other key will cause NOTEPAD to open the existing "LayNames.Txt" file. 
  • On a large drawing I often keep Notepad open on the desktop with a Layer list going.
    If you don't wish to open an instance of Notepad then simply delete that portion of the macro.
  • Obviously you can copy & Paste from notepad to Excel, or open the LAyNames.txt file directly from excel.
    Actually you should be able to replace the 
    CMDSTR$ = "NOTEPAD.EXE "+" LayNames.TXT"
    with a call to Excel, but I have not tried that....

    Note: you must "Hit R" the first time you run this or Notepad will open an empty file.
    There is no error checking for LayNames.txt not found.

    '---------------start of macro--------------
    'listlayr.d3m
    Window 3,40
    print "Hit R to refresh the list"
    print "any other key to load existing"
    anykey k
    wclose
    Maxlayer = 100


    if k = 82 then 
    orglayr = sys(3) 'storage for original layer number
    open "o", 1, "LayNames.TXT"
    print #1,SYS$(2) 'print filename
    precision 0
    for Curlay = 1 to Maxlayer
    layer(curlay) = 14
    print #1, curlay, "-",Sys$(93)
    next
    close
    Layer(orglayer) = 14 
    end if

    'open the file in Notepad
    CMDSTR$ = "NOTEPAD.EXE "+" LayNames.TXT"
    RUN CMDSTR$,1
    '----------------------------------------------------

File to Download: laynames.txt