Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Links to VBScript Output 1

Status
Not open for further replies.

EMoore12

Technical User
Oct 6, 2004
30
0
0
US
Hello,
This is my first attempt at writing something in VBScript.
I have some code that searches a location on the network and outputs all files ending with a certain extension. The output is written to a .htm file. What I would like to happen is for the output to contain links to the documents located on the network. Could anyone advise?Here is a sample of the code that I'm using.


...ecm

Dim objFSO
Dim ofolder
Dim objStream

Set objFSO = CreateObject("scripting.filesystemobject")

'create the output file
Set objStream = objFSO.createtextfile("K:\orkand\DAEBTools\TSASearch.htm",True)
CheckFolder (objFSO.getfolder("I:\CABINETS\TSB\TSAREPORT\")), objStream
MsgBox "File Search Completed." + vbCr + "Please check."

Sub CheckFolder(objCurrentFolder, objLogFile)

Dim strTemp
Dim strSearch
Dim strOutput
Dim objNewFolder
Dim objFile
Dim objStream

strSearch = ".pdf"
For Each objFile In objCurrentFolder.Files
strTemp = Right(objFile.Name,4)
If UCase(strTemp) = UCase(strSearch) Then
strOutput = CStr(objFile.Path) _
+ "," + chr(32) + CStr(objFile.Size) _
+ "," + chr(32) + CStr(objFile.Type) + "," _
+ chr(32) +CStr(objFile.datelastaccessed)
objLogFile.writeline strOutput

End If

Next

For Each objNewFolder In objCurrentFolder.subFolders
CheckFolder objNewFolder, objLogFile
Next

End Sub
 
Replace this:
strOutput = CStr(objFile.Path) _
with tis:
strOutput = "<A href=" & CStr(objFile.Path) & ">" & CStr(objFile.Path) & "</A>" _

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV! That worked like a charm.

...ecm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top