Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Convert Text to HTML Table and e-mail

Posted on 2012-12-27
3
Medium Priority
?
203 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 26

Accepted Solution

by:
Leon Fester earned 1500 total points
ID: 38723795
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
ID: 38726294
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
ID: 38734195
save it as html and then import it under msg body
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick step-by-step overview of installing and configuring Carbonite Server Backup.
An article on effective troubleshooting
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

610 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