Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Colorizing output

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,42113
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Colorizing output
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Colorizing output - 1/17/2007 12:44:13 AM   
  ebroo

 

Posts: 2
Score: 0
Joined: 1/17/2007
Status: offline
Hi all,

I have a small script to cut up a log file, and I am looking for suggestions on formatting and colorizing the output. The script reads a log of dates/times users login and cuts it into one line per in the output file.
This file eventually gets emailed - but lately it's looking a little bland

With vbs can you colorize output without putting it in html?

Any thoughts appreciated -

E

Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const TristateUseDefault = -2
Const TristateTrue = -1
Const TristateFalse = 0

Set fs = CreateObject ("Scripting.FileSystemObject")
Set rf = fs.OpenTextFile ("e:\reports\logonoff.txt", ForReading, True)
Set wf = fs.OpenTextFile ("e:\reports\tslog.txt", ForWriting, True)
Do While rf.AtEndOfStream <> True
For i = 0 to 1
   count = 0
   theLine = ""
   Do While rf.AtEndOfLine <> True
     theLine = theLine + rf.Read(1)
     count = count + 1
   Loop
   rf.skip(2)
   For j = count to 20
     theLine = theLine + " "
   Next
' theLine = rf.ReadLine
   wf.Write theLine
Next
wf.WriteLine
rf.SkipLine
Loop
rf.close
wf.close
 
 
Post #: 1
 
 RE: Colorizing output - 1/17/2007 1:27:07 AM   
  dm_4ever


Posts: 2721
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
Not with vbs.  side note: you can do that with powershell

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ebroo)
 
 
Post #: 2
 
 RE: Colorizing output - 1/17/2007 1:41:37 AM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
ebroo .log files .txt are not colourful
how about excel .xls or .csv

dm_4ever I know you would know how to do it to excel.

(in reply to dm_4ever)
 
 
Post #: 3
 
 RE: Colorizing output - 1/17/2007 1:49:13 AM   
  ebroo

 

Posts: 2
Score: 0
Joined: 1/17/2007
Status: offline
Ok, instead of colorizing, any text formatting tips?? :)

Thanks

E

(in reply to ebroo)
 
 
Post #: 4
 
 RE: Colorizing output - 1/17/2007 1:53:16 AM   
  dm_4ever


Posts: 2721
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
With excel you can change the color of the text in a cell with something like this: objExcel.Cells(1, 1).Font.ColorIndex = 2 You can change the background color with something like this:  objExcel.Cells(1, 1).Interior.ColorIndex = 44 

To see the available colors you can run this script:


      

Of course you can always use HTML/HTA and have it run your script and display it however you want.



< Message edited by dm_4ever -- 1/17/2007 1:54:35 AM >


_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to gdewrance)
 
 
Post #: 5
 
 RE: Colorizing output - 1/18/2007 12:37:02 AM   
  SAPIENScripter


Posts: 276
Score: 2
Joined: 11/1/2006
From: SAPIEN Technologies
Status: offline
PowerShell's Write-Host cmdlet supports changing the text color as well as the background color of the text if you just want to write to the console. You could  also create a Word doc and colorize the text.

_____________________________

Jeffery Hicks
Windows PowerShell MVP
SAPIEN Technologies - Scripting, Simplified. www.SAPIEN.com

Follow Me: http://www.twitter.com/JeffHicks

(in reply to ebroo)
 
 
Post #: 6
 
 RE: Colorizing output - 1/19/2007 5:23:18 PM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
here is how i format my login checker output:
(enclosed in a code block to preserve the spacing)


      

_____________________________

Have you searched here ?
VBScript Fundamentals
My Site

(in reply to ebroo)
 
 
Post #: 7
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Colorizing output Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts