HTA Script To Browse For A Folder And List The Files In The Active Window

 

This HTA script like the VBS Script To Browse For A Folder And List The File Contents In Excel script will allow for you to browse for a directory folder and then it will send all of the file contents to an excel spreadsheet sorted alphabetically. This script can be used to gather a list of the music or video files you have in a particular location at home. At work or at the office it can be useful for listing the contents of a particular SMS inbox.

 

HTA Script:

 

<html>

<Head>

<Title>HTA Script</Title>

<Style>

Body {Background-Color: CornSilk}

</Style>

 

<HTA:Application

Caption = Yes

Border = Thick

ShowInTaskBar = No

MaximizeButton = Yes

MinimizeButton = Yes>

 

<Script Language = VBScript>

Sub WindowsLoad

 

Set objShell = CreateObject("Shell.Application")

Set objFolder = objShell.BrowseForFolder (0, "Select The Folder To Enumerate :", (0))

If objFolder Is Nothing Then

Wscript.Quit

Else

Set objFolderItem = objFolder.Self

objPath = objFolderItem.Path

End If

 

Set objFso = CreateObject("Scripting.FileSystemObject")

Set objFolder = objFso.GetFolder(objPath)

For each objFile in objFolder.Files

If objFolder.Files.Count > 0 Then

 

Window.Document.Title = "Information For " & objPath

strHtml = strHtml & "<td><Font color = Blue>" & objFile.Name & "</font></Br>"

DataArea.InnerHtml = strHtml

End If

Next

End Sub

 

</Script><Body>

<p><h3 align = center><font color='Orange'>Please Visit myITforum.Com</font></h3>

<div></div>

<input Type = "Button" Value = "Browse For Folder" Name = "Run_Button" onClick = "WindowsLoad"><p></td>

<Span Id = "DataArea"></Span></Body><Div Align = "Center">

<P><A Href="http://myitforum.com/cs2/blogs/dhite">Created For myITforum By Don Hite</A>

 

 

Published Sunday, June 24, 2007 8:17 AM by dhite
Filed under:

Comments

No Comments