Solved

Convert Text to HTML Table and e-mail

Posted on 2012-12-27
3
198 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
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

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

Suggested Solutions

A quick step-by-step overview of installing and configuring Carbonite Server Backup.
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

713 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