Solved

Convert Text to HTML Table and e-mail

Posted on 2012-12-27
3
193 Views
Last Modified: 2013-02-11
I have text file with following columns. I want the to converted to HTML table and the HTML file to be e-mailed.

NASvolumeName | DFSName                 |   Total Size |    Free Size
\\NAS01\Vol1        | \\Dom1\fileshr1       |  1,800        |   600

"|" should be used as a separator.
0
Comment
Question by:principiamanagement
3 Comments
 
LVL 26

Accepted Solution

by:
Leon Fester earned 500 total points
Comment Utility
http://www.petri.co.il/forums/showthread.php?t=59619
Based on the topics selected, I'm assuming you're generating the output from VBS scripts.
If yes, then put set the output to HTML or create the email directly in an HTML format and send it from the VBS script.
http://www.petri.co.il/forums/showthread.php?t=59619

Alternatively, if you're getting the data in a .txt or .csv format then the easiest option is to create a macro in Excel.

I'm being a lazy admin here, but let me know if you need more help with the specific option you require...
0
 

Author Comment

by:principiamanagement
Comment Utility
With this script i tried to put for one volume but I am not sure how can do it for mutiple voulmes.....Here is teh script I am using....
 Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

Set objFS = CreateObject("Scripting.FileSystemObject")
Set objNewFile = objFS.CreateTextFile("NASVolumeUsage.htm")

On Error Resume Next

a =    "<style>"
a = a& "BODY{background-color:Lavender ;}"
a = a& "TABLE{font-size: 10pt; font-family: arial;}"
a = a& "TH{background-color: buttonface; font-decoration: bold;}"
a = a& "</style>"

objNewFile.WriteLine "<html>"
objNewFile.WriteLine "<head>"
objNewFile.WriteLine "<title>NAS Volume Usage Information</title>"
objNewFile.WriteLine a & "</head><body>"
objNewFile.WriteLine "<h2>NAS Volume Usage Information -- Date: " _
   & Now() & "</h2>"


   objNewFile.WriteLine "<table BORDER=""1"">"
   objNewFile.WriteLine "<tr><th>NAS Volume Name</th><th>DFS Share Name</th><th>Total</th><th>Free</th></tr>"
   
   Dim result , machine , drvletter , netpath , dompath
   Dim objNetwork , objDrive , objFSO 
   Const Decimals = 2 
   netpath = "\\nas1\vol1"
   dompath = "\\domain1\dfs1"
   Set objNetwork = CreateObject("WScript.Network") 
   Set objFSO = CreateObject("Scripting.FileSystemObject") 
   objNetwork.MapNetworkDrive "y:", netpath 
   Set objDrive = objFSO.Drives("y:\") 
   Total = FormatNumber(objDrive.TotalSize /1073741824, Decimals)
   Free = FormatNumber(objDrive.FreeSpace /1073741824, Decimals)
   objNewFile.WriteLine "<tr><td> " & netpath & " </td><td>&nbsp;" & dompath & "</td><td>&nbsp;" & Total & "</td><td>&nbsp;" & Free & "</td></tr>"   
   objNetwork.RemoveNetworkDrive "y:"

   
  
   
   objNewFile.WriteLine "</table>"
   objNewFile.WriteLine "<br />"

objNewFile.WriteLine "</body>"
objNewFile.WriteLine "</html>"
objNewFile.Close

wscript.quit

Open in new window

0
 
LVL 13

Expert Comment

by:Sandy
Comment Utility
save it as html and then import it under msg body
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article is in response to a question (http://www.experts-exchange.com/Networking/Network_Management/Network_Analysis/Q_28230497.html) here at Experts Exchange. The Original Poster (OP) requires a utility that will accept a list of IP addresses …
Resolve DNS query failed errors for Exchange
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now