Brent
|
| Posted: 06/08/2004, 8:12 AM |
|
I have a folder that contains PDF files and Word docs. Is there a way to automatically generate links in a grid or table to these files, and when a new file is placed in that folder a link is generated?
Any help is much appreciated,
Bren
|
|
|
 |
zolw
Posts: 51
|
| Posted: 06/08/2004, 9:35 AM |
|
Brent:
I hope this helps you.
Maybe you can change the Response.Write for a variable to insert as a label.
Carlos
'********************************************
'How many columns do you want
columnas = 1
'Variable to control columns (donīt cahnge)
cuenta = 0
'**** Folder Name *****
folder = "presentaciones\"
'********************************************
Response.Write "<table border=""0"" align=""center"" cellspacing=""0"" cellpadding=""0"" bordercolor=""#006699"">"
Set MyDirectory=Server.CreateObject("Scripting.FileSystemObject")
Set MyFiles=MyDirectory.GetFolder(Server.MapPath(folder))
For Each filefound in MyFiles.files
'If this is the first item on the row open the HTML <tr>
if cuenta = 0 then
Response.Write "<tr>"
End If
nombre = filefound.Name
'Response.Write "<br>Name: " & nombre
largo = Len(nombre)
'Response.Write "<br>Long: " & largo
posicion = largo - 3
'Response.Write "<br>Position: " & posicion
ext= Mid(nombre, posicion + 1, 3)
'Response.Write "<br>Ext: " & ext
ext = LCase(ext)
Select Case ext
case "xls"
icon = "<img src=""img/t_XLS.gif"" alt=""Excel"">"
case "pps"
icon = "<img src=""img/t_PPT.gif"" alt=""Power Point"">"
case "ppt"
icon = "<img src=""img/t_PPT.gif"" alt=""Power Point"">"
case "txt"
icon = "<img src=""img/t_TXT.gif"" alt=""TXT"">"
case "doc"
icon = "<img src=""img/t_DOC.gif"" alt=""Word"">"
case "pdf"
icon = "<img src=""img/t_PDF.gif"" alt=""PDF"">"
End Select
Response.Write "<td>" & icon &"</td><td align=""left"">"
Response.Write " <a href=""javascript:window.opener.document.item.archivo.value ='" & nombre & "',window.close();""><font size=""1"" face=""Arial"">" & nombre
cuenta = cuenta + 1
Response.Write "</a> </font>"
Response.Write "<br></td>"
'If this is the last <td> of the row, then we close it
If cuenta = columnas then
Response.Write "</tr>"
cuenta = 0
End If
Next
Response.Write "</table>"
_________________
Zolw
http://www.xlso.com |
 |
 |
|