Solved

Convert Text to HTML Table and e-mail

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

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

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 a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 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