Thanks for the response gk53. I found a link that got me what I needed. http://http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=6346&lngWId=4
I tried to post this the other day but it went to a moderator....unsure why. I wanted to provide the link for anyone looking for the same thing. In my case, this worked great but some of the folders have so many files that it was taking too long for a search. Now, I am doing the same thing but I am writing the file names to a database and searching the database. That way we only have to "build the database" as needed.
Here is what worked for me (the non database version). It was just too slow on folders with a lot of files.
Code:
<%@LANGUAGE="VBSCRIPT"%>
<html>
<head>
<script type="text/javascript">
function PlayIt(what){
document.getElementById('video').innerHTML='<object width="300" height="300" '
+'classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" '
+'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" '
+'standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">'
+'<param name="url" value="'+what+'">'
+'<param name="uiMode" value="full">'
+'<param name="autoStart" value="true">'
+'<param name="loop" value="true">'
+'<embed type="application/x-mplayer2" '
+'pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" '
+'showcontrols="true" uimode="full" width="300" height="300" '
+'src="'+what+'" autostart="true" loop="true">'
+'</object>';
document['body'].focus();
}
</script>
</head>
<body>
<INPUT TYPE="button" value="Refresh this page" onClick="parent.location='index.asp'">
<%
Response.AddHeader "Pragma", "No-Cache" 'try not to cache page
Response.CacheControl = "Private" 'try not to cache page
server.scripttimeout = 300 'script will time out after 5 minutes
%>
<div>
<center>
<%
dim filecounter, searchtext, directory 'dimention variables
dim fcount, fsize
filecounter = 0 'initialize filecounter to zero
searchtext = Trim(request("SearchText")) 'get the querystring SearchText
directory = Trim(request("Directory")) 'get the querystring Directory
if directory = "" then directory = "C:\inetpub\wwwroot\clips\video\" 'if no directory the set to c:\
'Write the Search Form to the page
response.write "<form name='f2' action='index.asp' method=get>" & _
" <input type=text name=SearchText size=20 value=" & Chr(34) & searchtext & _
Chr(34) & "> <input type=hidden name=Directory size=20 value=" & _
Chr(34) & directory & Chr(34) & "> <input type=submit value='Search Newsclips' onClick='parent.location='index.asp'></form><br></div>"
if searchtext <> "" Then 'if there is a file to search for then search
set rs = createobject("adodb.recordset")
rs.fields.append "FilePath",200,255
rs.fields.append "FileName",200,255
rs.fields.append "FileSize",200,255
rs.fields.append "FileDate",7,255
rs.open
Recurse directory 'call the subroutine to traverse the directories
Sub Recurse(Path)
'create the file system object
Dim fso, Root, Files, Folders, File, i, FoldersArray(1000)
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set Root = fso.getfolder(Path)
Set Files = Root.Files
Set Folders = Root.SubFolders
fcount = 0 'zero out the file count variable
'traverse through the subdirectories in the current directory
Response.Write ("<form action=""submit.asp"" method=""post"" name=""f1"">")
Response.Write ("<center><select name=""files"" onchange=""PlayIt(this.value);this.blur()"" >")
Response.Write ("<option value=""null.mpg"">" & "-- Please Select Searched Newsclip --" & "</option>")
For Each Folder In Folders
FoldersArray(i) = Folder.Path
i = i + 1
Next
'traverse through the files in the current folder or subfolder
For Each File In Files
'check if the search string is found
num = InStr(UCase(File.Name), UCase(searchtext))
'if it is then update the recordset and sort it
if num <> 0 then
filecounter = filecounter + 1
rs.addnew
rs.fields("FilePath") = File.Path
rs.fields("FileName") = File.Name
rs.update
rs.Sort = "FileName ASC"
end if
Next
'recurse through the current directory until
'all subfolders have been traversed
For i = 0 To UBound(FoldersArray)
If FoldersArray(i) <> "" Then
Recurse FoldersArray(i)
Else
Exit For
End If
Next
End Sub
'if files were found then write them to the document
If filecounter <> 0 then
filecounter = 0
do while not rs.eof
filecounter = filecounter + 1
Response.Write ("<option value=""" & "video/" & rs.fields("FileName") & """>" & rs.fields("FileName") & "</option>" & vbCrLf)
rs.movenext
loop
Response.Write ("</select>")
else
Response.Write("no files found") 'no files were found
end if
end if
%>
<input type="submit" value="Send this clip to Carbon Farm">
<div id="video" align="center">
<object width="300" height="300"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">
<param name="url" value="null.wmv">
<param name="uiMode" value="full">
<param name="autoStart" value="true">
<param name="loop" value="true">
<embed type="application/x-mplayer2"
pluginspage="http://microsoft.com/windows/mediaplayer/en/download/"
showcontrols="true" uimode="full" width="300" height="300"
src="" autostart="1" loop="true">
</object>
</form>