Jump to content

[vbs] Img2html Scan And Search For Images With Extension Like Jpg,gif,png,bmp


Hackoo

Recommended Posts

Hi salut.gif

This VBScript Scan and Search for images with extension like jpg ,gif,png,bmp in the folder and subfolders and list them in a html output file

'This VBScript Scan and Search for images with extension like jpg,gif,png,bmp 
'in the folder and subfolders and list them in a html output file.
'© Hackoo © 2011
start_folder = ".\" ' The Current Directory for scaning images
htmfile = "ListImage.htm"
ext = Array("jpg","gif","png","bmp")
Signature = "<br><center><font size=10 FACE=Comic sans MS style=font-weight:bold Color=red>©<br><img src=http://photomaniak.com/upload/out.php/i1102064_IDNlogo.gif>"
count=0
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(start_folder)
Set ws = CreateObject("WScript.Shell")
Set outfile = fso.CreateTextFile(htmfile)


outfile.WriteLine "<html><body>"
ListDirectory folder, ext 'Call The Recursive function
outfile.WriteLine "<br><center><font color=red>Le Nombre total des images est de "& count & "</font>"
outfile.WriteLine Signature
outfile.WriteLine "</body></html>"
outfile.Close
Question = MsgBox("The Total Count of images is " & count & vbCrLf &" Do you want to List them now ?",vbYesNo+32,"Total Count of images")
If Question = vbYes Then
Explorer htmfile
else
wscript.Quit
End If

Sub ListDirectory(folder, ext)
For Each file In folder.Files
cheminFic = folder & "\" & file.name
For i = lbound(ext) to ubound(ext)
If UCase(ext(i)) = UCase(fso.GetExtensionName(file.Name)) Then
strFilePath = file.ParentFolder
outfile.WriteLine "<center><a target=_Blank href="& qq(cheminFic) &">"&_
"<img src= "& qq(cheminFic) &" width=80% height=100%><BR><B><font color=red>"&_
"<a href='" & strFilePath & "'>The Location of " & file.Name & "</a></font><B><br><hr>"
count=count+1
End If
Next
Next
For Each fldr In folder.subfolders
ListDirectory fldr, ext
Next
End Sub

Function Explorer(File)
Set ws=CreateObject("wscript.shell")
ws.run "Explorer "& File & "\"
end Function

Function qq(strIn)
qq = Chr(34) & strIn & Chr(34)
End Function[/CODE]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...