0

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>
2
  • Use CSS. Wrap the text and images in divs Commented Sep 17, 2023 at 8:36
  • Assume this is a HTA because VBScript will not work in modern browsers. Also I'm not sure text/vbs is even a valid MIME type, you should be using text/vbscript. Commented Sep 18, 2023 at 9:10

1 Answer 1

0

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.