04-02-2006, 07:38 AM
Not sure what's wrong with this code. It's supposed to take all the JPGs in a folder and make a hyperlinked list on a webpage, but when I try to run it a get an error in MSVCRT.dll.
Also, this line:
Doesn't seem to be doing anything-- as in, the string "filename" is always empty.
Maybe the two problems are linked? Seems like this should have been easy to hunt down, but nothing I do will fix it.
Here's the full code:
--j_k
Also, this line:
Code:
LINE INPUT #tempfilehandle, filename
Doesn't seem to be doing anything-- as in, the string "filename" is always empty.
Maybe the two problems are linked? Seems like this should have been easy to hunt down, but nothing I do will fix it.
Here's the full code:
Code:
OPTION EXPLICIT
DIM htmlfile AS STRING
DIM title AS STRING
DIM filename AS STRING
DIM htmlfilehandle AS INTEGER, tempfilehandle AS INTEGER
SCREEN 0
INPUT "Output HTML file? ", htmlfile
INPUT "HTML page title? ", title
IF title = "" THEN title = "Photos"
IF htmlfile = "" THEN
htmlfile = "PHOTOS.HTML"
ELSEIF INSTR(htmlfile, ".") = 0 THEN
htmlfile = htmlfile + ".HTML"
END IF
PRINT ""
PRINT "Generating file list... ";
SHELL "DIR *.JPG /b > temp.dat"
PRINT "done"
PRINT ""
PRINT "Creating webpage " + UCASE$(htmlfile) + "... ";
htmlfilehandle = FREEFILE
tempfilehandle = FREEFILE
OPEN htmlfile FOR OUTPUT as htmlfilehandle
OPEN "temp.dat" FOR INPUT as tempfilehandle
PRINT #htmlfilehandle, "<html>"
PRINT #htmlfilehandle, "<head><title>" + title + "</title></head>"
PRINT #htmlfilehandle, "</body>"
DO UNTIL EOF(tempfilehandle)
LINE INPUT #tempfilehandle, filename
PRINT #htmlfilehandle, "<a href=" + filename + ">" + filename + "</a><br>"
LOOP
CLOSE #tempfilehandle
PRINT #htmlfilehandle, "</body>"
PRINT #htmlfilehandle, "</html>"
CLOSE #htmlfilehandle
KILL "temp.dat"
PRINT "done"
END
--j_k