First all of this activity is considered local. Simply put there is no web server.
I have a two step process.
Use VBS to create an html file and populate it with links to images in a specific folder I type into a msgbox.
Open the html file in browser of my choice.
I've spent a fruitless evening trying to combine this into a single step - html page has an input box, press button --> images appear.
Just to be clear at the moment the VBS script output simply has
img src="c:\temp\01.png"
with opening and closing tags, where there is a file called 01.png in the folder temp, and then 02.png would be below that etc.
My attempt this evening was to find a way to simply display a list of files onto the page with something like document.write, or its equivalent, but I didn't get that far. Any attempt to access the file system seems to cause the script to fail.
Thanks for any help.
I have a vbscript at the moment for my first step. I would like to know how to embed the function / html output into a single html file.
I envisage that the html page would have an input field, a 'go' button, and then the results would be the images in the folder appearing on the page. All using client sided scripting.
My vbscript is pretty similar to the one below, but since I know I'm only going to be given png's that's all I look for (and all that should be there for that matter).
Sorry if I keep putting things in the wrong place.
Current HTML sample output is below.
<html><head></head><body>
<img src = "c:\temp\credit.png"<hr>.<hr>
<img src = "c:\temp\NTK_01.png"<hr>.<hr>
</body></html>
-
dim objFSO
dim objFolder
dim colFiles
dim filelist
dim objStartFolder
dim pathToImage
dim iend
iend = """<hr>.<hr>" & vbcrlf 'vbcrlf if for readability of html only
const isrc = "<img src = """
const FileToWrite = "c:\temp\images.html"
'const objStartFolder = "C:\Temp" 'Used when testing so don't have to have the input box.
const For_Appending = 8
const For_Writing = 2
objStartFolder = InputBox("Folder path to open i.e. c:\temp") 'Grab the user path.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(objStartFolder) 'No error checking cause its just me
Set colFiles = objFolder.Files
filelist = "<html><head></head><body>" & vbcrlf 'Create the html code and store it in this variable.
For Each objFile in colFiles
'There should only be images, but i created this when testing and left it in.
if right(objFile.Name,3) = "png" then
pathToImage = objFolder.path & "\" & objFile.Name
filelist = filelist & isrc & pathToImage & iend
'Output line should be:
'<img src="c:\temp\01.png"><hr>.<hr>
end if
Next
filelist = filelist & "</body></html>" 'Close the html data
wscript.echo filelist 'Show what the html file will look like - sanity check.
'Open the file, overwrite the existing contents and close the file
set htmlout = objFSO.OpenTextFile(FileToWrite,For_Writing,TRUE)
htmlout.write filelist
htmlout.close