It is currently May 4th, 2024, 4:56 pm

Changing an Image based on a value

Get help with creating, editing & fixing problems with skins
User avatar
GHOST®
Posts: 55
Joined: March 11th, 2011, 6:33 pm
Location: Garden City, MI

Re: Changing an Image based on a value

Post by GHOST® »

smurfier wrote:Image meter, yes, without problems. Bar meters, I haven't gotten such a method to work.
Jomann wrote:I am trying to make my meter change the image after my C drive has low disk base

I have been trying to use

Code: Select all

[MeasureMemory%]
Measure=Calc
Formula=ROUND(100 - ((MeasureFreeC1 / (MeasureFreeC2 + 1)) * 100))
MinValue=0
MaxValue=100

[BARImage]
Measure=Calc
Formula=([MeasureMemory%] < 20 ? 1 : ([MeasureMemory%] > 20 ? 2))
Substitute="2":"Bar2.png", "1":"Bar1.png"
DynamicVariables=1

[MeterFreeCBar]
Meter=Bar
MeasureName=MeasureFreeC
X=2
Y=2
W=124
H=36
BarImage=[BARImage]
BarOrientation=HORIZONTAL
DynamicVariables=1
Instead of an image it gives my bar a strange color depending on the less or greater values
I also read that using images was impossible

I just want my BarImage to change depending on how much free space I have.

So If anyone has a solution to this I would be very grateful.
Not sure if I'm understanding all this correctly, but maybe you can modify this for your purposes??
Basically this bit graduates my Battery from Green to Red based on the Battery %, with the color changing every % changed in either direction. Uses Meter=Bar, No images, other than the battery outline and ascessories .pngs.

[MSUR_Battery_ColorBar]
Measure=CALC
Formula=([MSUR_BatteryPrcnt]/105)*250
DynamicVariables=1

[Battery_ColorBar]
MeasureName=MSUR_BatteryPrcnt
Meter=BAR
BarColor=127,[MSUR_Battery_ColorBar],0,#BattAlpha#
DynamicVariables=1
BarOrientation=HORIZONTAL
ToolTipHidden=#TTH#
ToolTipTitle=" BATTERY DETAILS"
ToolTipText=" Currently @ [MSUR_BatteryPrcnt]% of Capacity#CRLF# [MSUR_ChargeStatus]#CRLF#Time Before Discharged is [MSUR_BattLifetime]"
X=-112r
Y=7r
W=95
H=20
LeftMouseUpAction=#!E# [control.exe powercfg.cpl]
Group=Settings

Code: Select all

[Rainmeter]
	Author=GHOST®
	AlwaysOnTop=-2
	AppVersion=2000000
	BackGroundMode=3
	Draggable=1
	KeepOnScreen=1
	SavePosition=1
	SnapEdges=1
	Update=1000
; MouseOverAction=!RainmeterSetTransparency 255 #CurrentConfig#
; MouseLeaveAction=!RainmeterSetTransparency 63.75 #CurrentConfig#

[Variables]
@include1=#SKINSPATH#GHOST®\Resources\Variables\GHOST®Styles.inc
@include2=#SKINSPATH#GHOST®\Resources\Variables\GHOST®Variables.inc

[+++Begin_Battery--------------------------------------------------------------]

[MSUR_PowerState]
Measure=PLUGIN
Plugin=Plugins\PowerPlugin.dll
PowerState=ACLINE
IfAboveValue=0
	IfAboveAction=#!E# [#!RmTMtG# PowerStateOn\Off][#!RmDMs# MSUR_BatteryWarning_Audio]
IfBelowValue=1
	IfBelowAction=#!RmTMtG# PowerStateOn\Off

[MSUR_ChargeStatus]
Measure=CALC
Formula=(([MSUR_BatteryPrcnt]-99) + [MSUR_PowerState]) = 2 ? 1 : ([MSUR_PowerState]  = 1 ? 2 : 3)
DynamicVariables=1
	Substitute= ".0":"", "3":"Unplugged & Discharging ", "2":"    Plugged In & Charging", "1":"Plugged In & Fully Charged"


[MSUR_BattLifetime]
Measure=PLUGIN
Plugin=Plugins\PowerPlugin.dll
PowerState=LIFETIME
Format="%#H:%M"
	Substitute="Unknown":"Infinite"

[Battery_BackGround]
Meter=IMAGE
MeterStyle=Batt_BackGround_STYL
	MouseOverAction=#!E# [#!RmSMtG# Buttons][#!RmRD#]
	MouseLeaveAction=#!E# [#!RmHMtG# Buttons][#!RmRD#]


[ACPlug.png_On]
Meter=IMAGE
ImageName=#RsrcPath#ACPlug.png
ImageTint=255,255,255,255
AntiAlias=1
	X=7r
	Y=1r
	W=20
	H=39
Group=PowerStateOn\Off

[ACPlug.png_Off]
Meter=IMAGE
ImageName=#RsrcPath#ACPlug.png
ImageTint=255,255,255,63.75
AntiAlias=1
	X=r
	Y=r
	W=20
	H=39
Group=PowerStateOn\Off
Hidden=1

[DCVolt.png_Off]
Meter=IMAGE
ImageName=#RsrcPath#DCVolt.png
ImageTint=255,0,0,63.75
AntiAlias=1
	X=143r
	Y=r
	W=18
	H=36
Group=PowerStateOn\Off

[DCVolt.png_On]
Meter=IMAGE
ImageName=#RsrcPath#DCVolt.png
ImageTint=255,0,0,255
AntiAlias=1
	X=r
	Y=r
	W=18
	H=36
Group=PowerStateOn\Off
Hidden=1

[MSUR_Battery_ColorBar]
Measure=CALC
Formula=([MSUR_BatteryPrcnt]/105)*250
DynamicVariables=1

[Battery_ColorBar]
MeasureName=MSUR_BatteryPrcnt
Meter=BAR
BarColor=127,[MSUR_Battery_ColorBar],0,#BattAlpha#
DynamicVariables=1
BarOrientation=HORIZONTAL
ToolTipHidden=#TTH#
ToolTipTitle="          BATTERY DETAILS"
ToolTipText="   Currently @ [MSUR_BatteryPrcnt]% of Capacity#CRLF#     [MSUR_ChargeStatus]#CRLF#Time Before Discharged is [MSUR_BattLifetime]"
	X=-112r
	Y=7r
	W=95
	H=20
LeftMouseUpAction=#!E# [control.exe powercfg.cpl]
Group=Settings

[Battery.png]
Meter=IMAGE
ImageName=#RsrcPath#Battery.png
	X=-4r
	Y=r
	W=109
	H=20
Group=Settings

[MSUR_BatteryPrcnt]
Measure=PLUGIN
PlugIn=PlugIns\PowerPlugin.dll 
PowerState=PERCENT
IfAboveValue=10
	IfAboveAction=#!E# [#!RmDMsG# WarningMSUR][#!RmHMtG# WarningMETR]
IfBelowValue=11
	IfBelowAction=#!E#  [#!RmEMsG# WarningMSUR][#!RmSMtG# WarningMETR]

[Battery_Percentage]
MeasureName=MSUR_BatteryPrcnt
Meter=STRING
MeterStyle=Batt_Percentage_STYL
Group=Settings

[MSUR_BatteryWarning_Audio]
Measure=CALC
Formula=Counter % 46
IfAboveValue=0
	IfAboveAction=!execute [PLAY #RsrcPath#Warning.wav]
Group=WarningMSUR
	
[MSUR_BatteryWarning_Visual]
Measure=CALC
Formula=Counter % 2
IfAboveValue=0
	IfAboveAction=#!E# [#!RmSMt# Batt_Warning_Lgt]
IfEqualValue=0
	IfEqualAction=#!RmTMtG# WarningMETR
Group=WarningMSUR
Disabled=1

[Batt_Warning_Drk]
Meter=STRING
MeterStyle=Batt_WarningDrk_STYL
Text=WARNING
Group=WarningMETR

[Batt_Warning_Lgt]
Meter=STRING
MeterStyle=Batt_WarningLgt_STYL
Text=WARNING
Group=WarningMETR

[;+++Skin_Border_Lines-------------------------------------------------------]
	
[LineTopLft]
Meter=IMAGE
MeterStyle=Batt_HrzLineLft_STYL
[LineTopRgt]
Meter=IMAGE
MeterStyle=Batt_HrzLineRgt_STYL
[LineBttmRgt]
Meter=IMAGE
MeterStyle=Batt_HrzLineRgt_STYL
	X=r
	Y=39r
[LineBttmLft]
Meter=IMAGE
MeterStyle=Batt_HrzLineLft_STYL
	X=-84r
	Y=r
	
[LineLftTop]
Meter=IMAGE
MeterStyle=Batt_VrtLineTop_STYL
[LineLftBttm]
Meter=IMAGE
MeterStyle=Batt_VrtLineBttm_STYL
[LineRgtBttm]
Meter=IMAGE
MeterStyle=Batt_VrtLineBttm_STYL
	X=174r
	Y=r
[LineRgtTop]
Meter=IMAGE
MeterStyle=Batt_VrtLineTop_STYL
	X=r
	Y=-18r

[;+++Skin_Edit_Settings--------------------------------------------------------]		
	
[Settings_BkGrnd]
Meter=IMAGE
MeterStyle=BattSettings_BkGrnd_STYL
Group=Settings	

[SettingsButton.png]
Meter=IMAGE
ImageName=#RsrcPath#Settings.png
AntiAlias=1
DynamicVariables=1
ToolTipText=Modify Skin
	X=70
	Y=28
	W=12
	PreserveAspectRatio=1
LeftMouseUpAction=#!E# [#!RmTMtG# Settings][#!RmRD#]
Group=Buttons
Hidden=1

[CloseSkinButton.png]
Meter=IMAGE
ImageName=#RsrcPath#Close.png
AntiAlias=1
DynamicVariables=1
ToolTipText=Close Skin
	X=95
	Y=2r
	W=8
	PreserveAspectRatio=1
LeftMouseUpAction=#!E# [#!RmDC# #CurrentConfig#]
Group=Buttons
Hidden=1

[Set_BkGrndColor_Lft_Bttn.png]
Meter=BUTTON
ButtonImage=#RsrcPath#SettingsButtons.png
ImageTint=#BattSC1#
ToolTipText=BG Color Left
	X=26
	Y=0
LeftMouseUpAction=#!E# ["#ADDONSPATH#RainRGB\RainRGB.exe" "VarName=BattSC1" "FileName=#incPath#" "RefreshConfig=#CurrentConfig#"]
Group=Settings
Hidden=1

[Set_BkGrndAlpha_Lft_Bttn.png]
Meter=BUTTON
ButtonImage=#RsrcPath#SettingsButtons.png
ImageTint=255,255,255,255
ToolTipText=BG Alpha Left
	X=r
	Y=17r
LeftMouseUpAction=#!E# ["#ADDONSPATH#RainRGB\RainRGB.exe" "VarName=BattSC1A" "FileName=#incPath#" "RefreshConfig=#CurrentConfig#"]
Group=Settings
Hidden=1

[Set_HrzLines_Bttn.png]
Meter=BUTTON
ButtonImage=#RsrcPath#SettingsButtons.png
ImageTint=#BattHrz#,255
ToolTipText=Horizontal Lines
	X=3R
	Y=8
LeftMouseUpAction=#!E# ["#ADDONSPATH#RainRGB\RainRGB.exe" "VarName=BattHrz" "FileName=#incPath#" "RefreshConfig=#CurrentConfig#"]
Group=Settings
Hidden=1

[Set_BarAlpha_Bttn.png]
Meter=BUTTON
ButtonImage=#RsrcPath#SettingsButtons.png
ImageTint=255,255,255,255
ToolTipText=Battery Alpha
	X=3R
	Y=r
LeftMouseUpAction=#!E# ["#ADDONSPATH#RainRGB\RainRGB.exe" "VarName=BattAlpha" "FileName=#incPath#" "RefreshConfig=#CurrentConfig#"]
Group=Settings
Hidden=1

[Set_VrtLines_Bttn.png]
Meter=BUTTON
ButtonImage=#RsrcPath#SettingsButtons.png
ImageTint=#BattVrt#,255
ToolTipText=Vertical Lines
	X=3R
	Y=r
LeftMouseUpAction=#!E# ["#ADDONSPATH#RainRGB\RainRGB.exe" "VarName=BattVrt" "FileName=#incPath#" "RefreshConfig=#CurrentConfig#"]
Group=Settings
Hidden=1

[Set_BkGrndColor_Rgt_Bttn.png]
Meter=BUTTON
ButtonImage=#RsrcPath#SettingsButtons.png
ImageTint=#BattSC2#
ToolTipText=BG Color Right
	X=3R
	Y=0
LeftMouseUpAction=#!E# ["#ADDONSPATH#RainRGB\RainRGB.exe" "VarName=BattSC2" "FileName=#incPath#" "RefreshConfig=#CurrentConfig#"]
Group=Settings
Hidden=1

[Set_BkGrndAlpha_Rgt_Bttn.png]
Meter=BUTTON
ButtonImage=#RsrcPath#SettingsButtons.png
ImageTint=255,255,255,255
ToolTipText=BG Alpha Right
	X=r
	Y=17r
LeftMouseUpAction=#!E# ["#ADDONSPATH#RainRGB\RainRGB.exe" "VarName=BattSC2A" "FileName=#incPath#" "RefreshConfig=#CurrentConfig#"]
Group=Settings
Hidden=1
"Do you want to be healed, now? Or would you prefer to bleed to death so I can try my hand at resurrection?"