home *** CD-ROM | disk | FTP | other *** search
/ Aminet 33 / Aminet 33 - October 1999.iso / Aminet / util / misc / HTML-Creator.lha / HTML-Creator / Source / Create_Index < prev    next >
Encoding:
Text File  |  1999-07-12  |  1.9 KB  |  81 lines

  1. ON ERROR GOTO fehler
  2. ver$="$VER: Part of the HTML-Creator V1.24"
  3. 1 mhfile%=1
  4. PRINT "Please enter the file name with the file list:"
  5. INPUT "",dateiname$
  6. OPEN"I",#1,dateiname$
  7. CLOSE 1
  8. IF dateiname$="" THEN 1
  9. 2 mhfile%=2
  10. PRINT "Please enter the output path for 'index.html':"
  11. INPUT "",pfad$
  12. IF pfad$="" THEN 2
  13. OPEN"I",#1,dateiname$
  14. a$=RIGHT$(pfad$,1)
  15.  IF a$=":" OR a$="/"THEN
  16.  Ausgabedatei$=pfad$+"index.html"
  17.  ELSE
  18.  Ausgabedatei$=pfad$+"/index.html"
  19.  END IF
  20. OPEN"O",#2,Ausgabedatei$
  21. PRINT#2,"<HTML>"
  22. PRINT#2,"<HEAD>"
  23. PRINT#2,"<TITLE>"
  24. PRINT#2,"Directory index of ";pfad$
  25. PRINT#2,"</TITLE>"
  26. PRINT#2,"</HEAD>"
  27. PRINT#2,"<BODY>"
  28. PRINT#2,"Directory index of ";pfad$
  29. PRINT#2,"<HR>"
  30. PRINT#2,"<P>"
  31. PRINT#2,"<TABLE BORDER=";CHR$(34);"0";CHR$(34);">"
  32. GOSUB einlesen
  33. PRINT#2,"</TABLE>"
  34. PRINT#2,"</P>"
  35. PRINT#2,"</BODY>"
  36. PRINT#2,"</HTML>"
  37. END
  38.  
  39. einlesen:
  40.  WHILE NOT EOF(1)
  41.  LINE INPUT#1,x$
  42.   IF LEN(x$)>28 THEN
  43.    IF LEFT$(x$,1)<>":" THEN
  44.    y$=LEFT$(x$,LEN(x$)-28)
  45.     FOR t%=LEN(y$) TO 1 STEP -1
  46.     '?MID$(y$,t%,1),t%:INPUT"",a
  47.     IF MID$(y$,t%,1)=" " THEN t1%=t%: t%=1
  48.     NEXT t%
  49.  
  50.     FOR t%=t1% TO 1 STEP -1
  51.     IF MID$(y$,t%,1)<>" " THEN filename$=LEFT$(y$,t%):t%=1
  52.     NEXT
  53.  
  54.     a$=RIGHT$(x$,LEN(x$)-t1%)
  55.     FOR t%=1 TO LEN(a$)
  56.     b$=MID$(a$,t%,1)
  57.     IF b$=" " THEN b$=" "
  58.     attribute$=attribute$+b$
  59.     NEXT
  60.  
  61.     IF VAL(RIGHT$(y$,3))>0 THEN
  62.     PRINT #2,"<TR><TD><KBD><A HREF=";CHR$(34);filename$;CHR$(34);">";filename$;"</A></KBD></TD><TD ALIGN=";CHR$(34);"RIGHT";CHR$(34);"><KBD>";attribute$;"</KBD></TD></TR>"
  63.     ELSE
  64.     PRINT #2,"<TR><TD><KBD><A HREF=";CHR$(34);filename$;"/index.html";CHR$(34);">";filename$;"</A></KBD></TD><TD ALIGN="CHR$(34);"RIGHT";CHR$(34);"><KBD>";attribute$;"</KBD></TD></TR>"
  65.     END IF
  66.    attribute$=""
  67.    END IF
  68.   END IF
  69.  WEND
  70. RETURN
  71.  
  72. fehler:
  73. CLOSE
  74. feh%=ERR
  75.  IF feh%=53 OR feh%=55 THEN
  76.  PRINT "File not found!"
  77.  IF mhfile%=1 THEN RESUME 1
  78.  IF mhfile%=2 THEN RESUME 2
  79.  END IF
  80. ?"Error number";feh%;" occurred. Exiting."
  81. END