Solved

Convert Text to HTML Table and e-mail

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
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.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

813 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

18 Experts available now in Live!

Get 1:1 Help Now