It is currently May 2nd, 2024, 9:41 am

Ping Line Dynamic Color

Get help with creating, editing & fixing problems with skins
Frusc999
Posts: 1
Joined: September 13th, 2012, 8:48 am

Ping Line Dynamic Color

Post by Frusc999 »

I am attempting to make a ping meter, and I am having difficulty with the dynamic colors. I would like to have it so that if the ping is 30000 (default timeout for ping?), or if the ping is <5 the ping line is displayed in red. If the ping is between 6 and 29999 if it could be displayed in white.

I am not very good at this, as i am sure you will be able to tell from the excess stuff i am assuming is in the code. (think i borrowed framework from a quadcore monitor)

Here is what i have, any help would be greatly appreciated.

Code: Select all

;Metadata added by RainBrowser
;http://rainmeter.net/RainWiki/index.php?title=Rainmeter_101#.5BMetadata.5D



[Metadata]
Name=Ping
Config=
Description=Ping
Instructions=
Version=0.1
Author=
License=
Variant=
Preview=

[Rainmeter]
MouseOverAction=!execute [!RainmeterShowMeter size][!RainmeterShowMeter MeterChange][!RainmeterShowMeter btn1][!RainmeterShowMeter About][!RainmeterShowMeter MeterMenu][!RainmeterShowMeter MeterClose][!RainmeterShowMeter MeterChange][!RainmeterRedraw]
MouseLeaveAction=!execute [!RainmeterHideMeter size][!RainmeterHideMeter MeterChange][!RainmeterHideMeter btn1][!RainmeterHideMeter About][!RainmeterHideMeter MeterMenu][!RainmeterHideMeter MeterClose][!RainmeterHideMeter MeterChange][!RainmeterRedraw]
MouseActionCursor=0
MiddleMouseUpAction=!RainmeterDeactivateConfig
Blur=#globalblurenable#
BlurRegion=#blurtype#,5,5,(#height#+5),(#height#+5),#blurcornerradius#
Update=50


[Variables]
@include=#ROOTCONFIGPATH#Common\Variables\UserVariables.inc
@include2=size.inc
@include3=#ROOTCONFIGPATH#Common\color\color.inc
@include4=#ROOTCONFIGPATH#Common\Variables\Languages\lang.inc


[shadow]
Meter=Image
ImageName=#ROOTCONFIGPATH#Common\Borders\#shadow#.png
x=0
y=0
w=(#height#)
h=(#height#/3)
ImageTint=#bordercolor#
Greyscale=1 

[bg]
Meter=Image
ImageName=C:\Users\Chad\Documents\Rainmeter\Skins\Backup\2012.05.21 02.19-17\WP7\Panels\Internet\btn12.png
X=5
Y=5
W=#Height#
H=(#Height#/2)

UpdateDivider=864000


[btn1]
Meter=IMAGE
ImageName=#Imagedir#\btn3.png
X=5
Y=5
Hidden=1
w=#height#
h=(#height#/2)

UpdateDivider=864000

[overlay]
Meter=Image
ImageName=#ROOTCONFIGPATH#Common\Overlay\#overlay#.png
x=5
y=5
UpdateDivider=864000
w=#height#
UpdateDivider=864000
h=(#height#/2)


[MeasurePing]
Measure=Plugin
Plugin=PingPlugin
DestAddress=www.google.com
MinValue=0
MaxValue=1000



[solid]
Meter=Image
W=60
H=20
SolidColor=0,0,0,1
UpdateDivider=864000


[MeterPing]
Meter=String
MeasureName=MeasurePing
X=(#height#/5*2)
Y=(#height#/2-20)
StringStyle=NORMAL
StringAlign=Left
FontColor=#textcolor2#,155
FontFace=Tahoma
FontSize=(#height#/21)
AntiAlias=1
Text="Ping (1000 Max.)"



[PingString]
Meter=String
MeasureName=MeasurePing
X=10
Y=(#height#/2-20)
StringStyle=Bold
FontColor=#textcolor2#,255
FontFace=Tahoma
FontSize=(#height#/20+0.5)
AntiAlias=1
Postfix= ms
NumOfDecimals=0


[PingLine]
Meter=Line
MeasureName=MeasurePing

X=5
Y=7
H=(#height#/2.63)
W=#height#
LineCount=1
FontColor=255,255,255,255
AntiAlias=1
UpdateDivider=16



-----overlay--

[overlay1]
Meter=Image
ImageName=#Imagedir#\btn3.png
MouseLeaveAction=!execute [!RainmeterHideMeter Overlay1][!RainmeterHideMeter AboutText][!RainmeterHideMeter AboutContent]
x=5
y=5
Hidden=1


[AboutText]
Meter=String
X=0
Y=-7
MeterStyle=DriveText
FontColor=255,255,255,255
FontSize=30
FontFace=#FontFaceLight#
Text=About
Antialias=1
Hidden=1

[AboutContent]
Meter=String
X=15
Y=40
w=130
h=120
FontColor=255,255,255,255
StringAlign=LEFT
FontSize=10
FontFace=#FontFaceUI#
Text= Monitor all four logical cpu's in your quadcore monster.
Antialias=1
Hidden=1
ClipString=1

[size]
Meter=BUTTON
ButtonImage=#ROOTCONFIGPATH#Common\Panel\size.png
X=(#Height#-10) 
Y=(#Height#/2-10)
ButtonCommand=!Execute ["#ROOTCONFIGPATH#Common\Size\size.exe" single "#CURRENTCONFIG#" "#SETTINGSPATH#"]
Hidden=1
UpdateDivider=864000


User avatar
thatsIch
Posts: 446
Joined: August 7th, 2012, 9:18 pm

Re: Ping Line Dynamic Color

Post by thatsIch »

Your answer lies withing IfActions [1]

The Basic idea is:
the measure you have returns a value. This value can be compared with either
  • IfAboveValue
  • IfEqualValue
  • IfBelowValue
if you have set your border you can perform an action with
  • IfAboveAction
  • IfEqualAction
  • IfBelowAction
you'll probably need something to display it [2]
to change their color you can use setoption bang [3]
with

Code: Select all

[!SetOption MeterHistogramm PrimaryColor _ENTERCOLOR_]
---
[1] http://rainmeter.net/cms/Measures-IfActions_beta
[2] http://rainmeter.net/cms/Meters-Histogram_beta
[3] http://rainmeter.net/cms/Tips-!SetOptionGuide