home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / vrac / aprs72a.zip / MKMAPLST.BAS < prev    next >
BASIC Source File  |  1995-02-06  |  3KB  |  81 lines

  1.  CLS
  2.  PRINT "This program will search through a given directory for all .MAP files and"
  3.  PRINT "will build a TEXT file in the necessary MAPLIST.xx format."
  4.  PRINT
  5.  PRINT "The maps will be sorted by size within each state, but the order will"
  6.  PRINT "in NO WAY be the proper heirarchical order!"
  7.  
  8.  PRINT
  9.  PRINT "but the text file can be used with an editor to build a proper MAPLIST.xx"
  10.  PRINT "file. "
  11.  PRINT
  12.  
  13.  x = 200
  14.  DIM MpNm$(x), LAcn(x), LOcn(x), Rng(x)
  15.  
  16.  MAPpath$ = "\APRS\MAPS"
  17.       PRINT "Enter path to the directory to scan if not "; MAPpath$;
  18.       INPUT a$: IF a$ <> "" THEN MAPpath$ = a$
  19.       PRINT "Enter name of output text file if not MAPCENS.txt";
  20.       INPUT a$: IF a$ <> "" THEN OUTFILE$ = a$ ELSE OUTFILE$ = "MAPCENS.txt"
  21.       SHELL "dir " + MAPpath$ + " >temp.txt"
  22.  
  23.      OPEN "temp.txt" FOR INPUT AS #1
  24.      OPEN OUTFILE$ FOR OUTPUT AS #3
  25.      DO UNTIL EOF(1)
  26.         LINE INPUT #1, a$: REM PRINT a$
  27.         IF LEN(a$) > 38 AND LEFT$(a$, 1) <> "." AND LEFT$(a$, 1) <> " " THEN
  28.            MpNm$ = LEFT$(a$, 8) + "." + MID$(a$, 10, 3)
  29.            IF RIGHT$(MpNm$, 3) = "MAP" THEN
  30.               nmp = nmp + 1
  31.               MpNm$(nmp) = MpNm$
  32.               PRINT "Opening "; MpNm$(nmp)
  33.               OPEN MAPpath$ + "\" + MpNm$(nmp) FOR INPUT AS #2
  34.               FOR i = 1 TO 3: LINE INPUT #2, a$: NEXT i
  35.               INPUT #2, LAcn(nmp): LINE INPUT #2, a$
  36.               INPUT #2, LOcn(nmp): LINE INPUT #2, a$
  37.               INPUT #2, Rng(nmp): LINE INPUT #2, a$
  38.               CLOSE #2 ' Finished all of that file
  39.            END IF
  40.         END IF 'if it was a valid file name
  41.      LOOP 'to the next MAP file
  42.      CLOSE #1 ' Finished that all files in that directory
  43.  
  44. Sort: 'First by size and then by state
  45.   FOR i = 1 TO nmp
  46.     FOR j = i TO nmp
  47.       IF Rng(i) < Rng(j) THEN
  48.          Temp$ = MpNm$(j): LA = LAcn(j): LO = LOcn(j): RA = Rng(j)
  49.          MpNm$(j) = MpNm$(i): LAcn(j) = LAcn(i): LOcn(j) = LOcn(i): Rng(j) = Rng(i)
  50.          MpNm$(i) = Temp$: LAcn(i) = LA: LOcn(i) = LO: Rng(i) = RA
  51.       END IF
  52.     NEXT j
  53.   NEXT i
  54.  
  55.   FOR i = 1 TO nmp
  56.     FOR j = i TO nmp
  57.       IF LEFT$(MpNm$(i), 2) > LEFT$(MpNm$(j), 2) THEN
  58.          Temp$ = MpNm$(j): LA = LAcn(j): LO = LOcn(j): RA = Rng(j)
  59.          MpNm$(j) = MpNm$(i): LAcn(j) = LAcn(i): LOcn(j) = LOcn(i): Rng(j) = Rng(i)
  60.          MpNm$(i) = Temp$: LAcn(i) = LA: LOcn(i) = LO: Rng(i) = RA
  61.       END IF
  62.     NEXT j
  63.   NEXT i
  64.  
  65.     
  66. Writeout:  
  67.      FOR i = 1 TO nmp
  68.          PRINT #3, MpNm$(i); ","; LAcn(i); ","; LOcn(i); ","; Rng(i); ","
  69.      NEXT
  70.      CLOSE #3
  71.      PRINT : PRINT "DONE!"
  72.      STOP
  73.     
  74.      END
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.