Display text file c...
 
Notifications
Clear all

We appreciate the contributions many of you have been able to make towards repairing the storm damage and keeping a roof over our heads. With your help we’ve been able to complete much of the critical work. There is still work to be done to secure the house and your continued support will be a huge help.

Guests have read-only access to our forums. If you wish to participate you will need to register. Be sure to activate your account from the email sent to you when you register.

[Solved] Display text file content hits in color

34 Posts
2 Users
0 Reactions
5,759 Views
(@vespi)
Eminent Member Registered
Joined: 1 year ago
Posts: 22
Topic starter  

I call up a monitoring via a Sharepoint list. The values are sent cyclically to a text file
e.g.

Citrix OK
Outlook problem
Intranet error

I would like to color-code the display.

[items]
COMMENT
ITEM=TEXTFILE
FILE=C:\Temp\status5.txt
INTERVAL=5000
COLOR=00FF00;FFFF00;FF0000
MATCH=OK;Problem;error

I am currently getting the error message: “File Info”


   
Quote
Glenn
(@glenn)
Member Admin
Joined: 8 years ago
Posts: 1903
 

what does the text file contents look like?


   
ReplyQuote
(@vespi)
Eminent Member Registered
Joined: 1 year ago
Posts: 22
Topic starter  

Here is the txt

Citrix OK
Outlook Problem
Intranet Störung

This post was modified 10 months ago 2 times by Vespi

   
ReplyQuote
Glenn
(@glenn)
Member Admin
Joined: 8 years ago
Posts: 1903
 

Posted by: @vespi

Here is the txt

Citrix OK
Outlook Problem
Intranet Störung

you want to display 3 lines of the text file, each color coded according to what the lines contain????

*or*

display 1 line of the text, color coded according to what the line contains???

 


   
ReplyQuote
(@vespi)
Eminent Member Registered
Joined: 1 year ago
Posts: 22
Topic starter  

@glenn 

All lines. Simply with color difference, depending on the fault status.
Citrix OK
Outlook problem
Intranet error

COLOR=00FF00;FFFF00;FF0000
MATCH=OK;Problem;error

A symbol or traffic light is not possible?


   
ReplyQuote
Glenn
(@glenn)
Member Admin
Joined: 8 years ago
Posts: 1903
 

can't help you with the symbols but here's what i came up with:

# retrieve the 3 lines of text
FILECONTENTS=interval:10, hidden:1, file:status5.txt, top:1,  set:t1=%1
FILECONTENTS=interval:10, hidden:1, file:status5.txt, tail:2, set:t2=%1
FILECONTENTS=interval:10, hidden:1, file:status5.txt, tail:1, set:t3=%1

# choose color of text 1
IF=value1:%t1%, comp:contains, value2:OK,      true:#00FF00, false:%silver%, set:c1=%1
IF=value1:%t1%, comp:contains, value2:Problem, true:#FFFF00, false:%c1%,     set:c1=%1
IF=value1:%t1%, comp:contains, value2:Error,   true:#FF0000, false:%c1%,     set:c1=%1

# choose color of text 2
IF=value1:%t2%, comp:contains, value2:Ok,      true:#00FF00, false:%silver%, set:c2=%1
IF=value1:%t2%, comp:contains, value2:Problem, true:#FFFF00, false:%c2%,     set:c2=%1
IF=value1:%t2%, comp:contains, value2:Error,   true:#FF0000, false:%c2%,     set:c2=%1

# choose color of text 3
IF=value1:%t3%, comp:contains, value2:Ok,      true:#00FF00, false:%silver%, set:c3=%1
IF=value1:%t3%, comp:contains, value2:Problem, true:#FFFF00, false:%c3%,     set:c3=%1
IF=value1:%t3%, comp:contains, value2:Error,   true:#FF0000, false:%c3%,     set:c3=%1

# display 3 lines of text
TEXT=interval:10, color:%c1%, text:%t1%
TEXT=interval:10, color:%c2%, text:%t2%
TEXT=interval:10, color:%c3%, text:%t3%

This assumes the text file contains *only* 3 lines of text.  This will set the color of each line depending if the line contains ok, problem or error.


   
ReplyQuote
(@vespi)
Eminent Member Registered
Joined: 1 year ago
Posts: 22
Topic starter  

@glenn 

Thankyou!

I still have the problem that the values per line are displayed twice.
I have added a link banner.
Is it also possible to display nothing if the .txt is empty? If it is empty, %1 is currently displayed

CONTROL=3,button-color:#2F2F2F,color:#ffffff,wide:2,left:-240,style:b,width:600,display:Störungsübersicht,uri:microsoft-edge: https://xx.sharepoint.com/sites/xx/Lists/DIAR%20Strungsmanagement/AllItems.aspx 

# retrieve the 3 lines of text
FILECONTENTS=interval:10, hidden:1, file:Status.txt, top:1, set:t1=%1
FILECONTENTS=interval:10, hidden:1, file:Status.txt, tail:2, set:t2=%1
FILECONTENTS=interval:10, hidden:1, file:Status.txt, tail:1, set:t3=%1

# choose color of text 1
IF=value1:%t1%, comp:contains, value2:OK, true:#00FF00, false:%silver%, set:c1=%1
IF=value1:%t1%, comp:contains, value2:Problem, true:#FFFF00, false:%c1%, set:c1=%1
IF=value1:%t1%, comp:contains, value2:Störung, true:#FF0000, false:%c1%, set:c1=%1

# choose color of text 2
IF=value1:%t2%, comp:contains, value2:OK, true:#00FF00, false:%silver%, set:c2=%1
IF=value1:%t2%, comp:contains, value2:Problem, true:#FFFF00, false:%c2%, set:c2=%1
IF=value1:%t2%, comp:contains, value2:Störung, true:#FF0000, false:%c2%, set:c2=%1

# choose color of text 3
IF=value1:%t3%, comp:contains, value2:OK, true:#00FF00, false:%silver%, set:c3=%1
IF=value1:%t3%, comp:contains, value2:Problem, true:#FFFF00, false:%c3%, set:c3=%1
IF=value1:%t3%, comp:contains, value2:Störung, true:#FF0000, false:%c3%, set:c3=%1

# display 3 lines of text
TEXT=interval:10, color:%c1%, text:%t1%, style:b
TEXT=interval:10, color:%c2%, text:%t2%, style:b
TEXT=interval:10, color:%c3%, text:%t3%, style:b
This post was modified 10 months ago by Vespi

   
ReplyQuote
Glenn
(@glenn)
Member Admin
Joined: 8 years ago
Posts: 1903
 

here's a modified version that will not display if status.txt is empty. note the changes to the FILECONTENTS and the use of BEGIN-IF.

showing values twice sounds like the text and display of TEXT are both in use

# retrieve the 3 lines of text
FILECONTENTS=interval:10, hidden:1, file:Status.txt, top:1, set:t1
FILECONTENTS=interval:10, hidden:1, file:Status.txt, tail:2, set:t2=%1
FILECONTENTS=interval:10, hidden:1, file:Status.txt, tail:1, set:t3

# choose color of text 1
IF=value1:%t1%, comp:contains, value2:OK, true:#00FF00, false:%silver%, set:c1=%1
IF=value1:%t1%, comp:contains, value2:Problem, true:#FFFF00, false:%c1%, set:c1=%1
IF=value1:%t1%, comp:contains, value2:Störung, true:#FF0000, false:%c1%, set:c1=%1

# choose color of text 2
IF=value1:%t2%, comp:contains, value2:OK, true:#00FF00, false:%silver%, set:c2=%1
IF=value1:%t2%, comp:contains, value2:Problem, true:#FFFF00, false:%c2%, set:c2=%1
IF=value1:%t2%, comp:contains, value2:Störung, true:#FF0000, false:%c2%, set:c2=%1

# choose color of text 3
IF=value1:%t3%, comp:contains, value2:OK, true:#00FF00, false:%silver%, set:c3=%1
IF=value1:%t3%, comp:contains, value2:Problem, true:#FFFF00, false:%c3%, set:c3=%1
IF=value1:%t3%, comp:contains, value2:Störung, true:#FF0000, false:%c3%, set:c3=%1
IF=value1:%t3%, comp:contains, value2:error, true:#FF0000, false:%c3%, set:c3=%1

# display 3 lines of text - display only if status.txt has text
BEGIN-IF=value1:[%t1%], comp:ne, value2:[], hidden:1, display:%1 %2 %3 %4
 TEXT=interval:10, color:%c1%, text:%t1%, style:b
 TEXT=interval:10, color:%c2%, text:%t2%, style:b
 TEXT=interval:10, color:%c3%, text:%t3%, style:b
END-IF

 

 


   
ReplyQuote
(@vespi)
Eminent Member Registered
Joined: 1 year ago
Posts: 22
Topic starter  

@glenn 
The Status.txt now only has "Citrix: OK" in it, but is still displayed on all 3 lines and duplicated.

New also with <n/a>

I have now listed all the items:

[items]
COLOR=#000001
WMI=:1,text:Modell:,,query:Win32_ComputerSystem,display:%Model%
HOST=,text:Hostname: ,display:%1
WMI=:1,text:S/N:,,query:Win32_BIOS,display:%serialnumber%
COMMENT
# retrieve the 3 lines of text
FILECONTENTS=interval:10, hidden:1, file:Status.txt, top:1, set:t1
FILECONTENTS=interval:10, hidden:1, file:Status.txt, tail:2, set:t2=%1
FILECONTENTS=interval:10, hidden:1, file:Status.txt, tail:1, set:t3

# choose color of text 1
IF=value1:%t1%, comp:contains, value2:OK, true:#00FF00, false:%silver%, set:c1=%1
IF=value1:%t1%, comp:contains, value2:Problem, true:#FFFF00, false:%c1%, set:c1=%1
IF=value1:%t1%, comp:contains, value2:Störung, true:#FF0000, false:%c1%, set:c1=%1

# choose color of text 2
IF=value1:%t2%, comp:contains, value2:OK, true:#00FF00, false:%silver%, set:c2=%1
IF=value1:%t2%, comp:contains, value2:Problem, true:#FFFF00, false:%c2%, set:c2=%1
IF=value1:%t2%, comp:contains, value2:Störung, true:#FF0000, false:%c2%, set:c2=%1

# choose color of text 3
IF=value1:%t3%, comp:contains, value2:OK, true:#00FF00, false:%silver%, set:c3=%1
IF=value1:%t3%, comp:contains, value2:Problem, true:#FFFF00, false:%c3%, set:c3=%1
IF=value1:%t3%, comp:contains, value2:Störung, true:#FF0000, false:%c3%, set:c3=%1
IF=value1:%t3%, comp:contains, value2:error, true:#FF0000, false:%c3%, set:c3=%1

# display 3 lines of text - display only if status.txt has text
BEGIN-IF=value1:[%t1%], comp:ne, value2:[], hidden:1, display:%1 %2 %3 %4
TEXT=interval:10, color:%c1%, text:%t1%, style:b
TEXT=interval:10, color:%c2%, text:%t2%, style:b
TEXT=interval:10, color:%c3%, text:%t3%, style:b
END-IF

Maybe you have another idea


   
ReplyQuote
Glenn
(@glenn)
Member Admin
Joined: 8 years ago
Posts: 1903
 

zip up your entire ini file and post it for me


   
ReplyQuote
(@vespi)
Eminent Member Registered
Joined: 1 year ago
Posts: 22
Topic starter  

Her is the File. 

Thankyou


   
ReplyQuote
Glenn
(@glenn)
Member Admin
Joined: 8 years ago
Posts: 1903
 

this is the results of the ini you just sent


   
ReplyQuote
Glenn
(@glenn)
Member Admin
Joined: 8 years ago
Posts: 1903
 

this is the same ini with empty status.txt


   
ReplyQuote
Glenn
(@glenn)
Member Admin
Joined: 8 years ago
Posts: 1903
 

this is with my changes


   
ReplyQuote
Glenn
(@glenn)
Member Admin
Joined: 8 years ago
Posts: 1903
 

this is with my changes and empty status.txt


   
ReplyQuote
Page 1 / 3
Glenn's Page