Modification GIF Folder Preview Script

63 views Asked by At

Maybe anyone here can help me to modify this script ? I want file name located under the gif & the text size is little bit smaller, so that more gif can appears in one row .

<script type="text/vbs">
set fso=CreateObject("Scripting.FileSystemObject")
set fldr=fso.GetFolder(".")
for each file in fldr.files
  if lcase(right(file.name,4))=".gif" then
    document.write "<img src=""" & file.name & """>"
    document.write file.name & "&#160;&#160;&#160;&#160;&#160;&#160;"
  end if
next
</script>
1

There are 1 answers

0
LesFerch On

As stated in the comments, you can use a bit of CSS applied to a Div and create a class to set the image size. The size can be specified in any units desired. Ems are used here because the size then remains reasonably constant across displays set at different scaling values. Here's the HTA code:

GIFshow.hta

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="x-ua-compatible" content="IE=10">
<script language="VBScript">
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(".")
For Each oFile In oFolder.Files
  If LCase(oFSO.GetExtensionName(oFile.Name)) = "gif" Then
    document.write "<div class=""image-container"">"
    document.write "<img class=""image"" src=""" & oFile.Name & """>"
    document.write "<br>" & oFile.Name
    document.write "</div>"
  End If
Next
</script>
<style>
  .image-container {
    display: inline-block;
    text-align: center;
    font-family: Segoe UI;
    font-size: 9pt;
  }
  .image {
    width: 10em;
    height: 10em;
  }
</style>
</head>
<body>
</body>
</html>