Hackit wrote: ↑March 21st, 2020, 9:56 pm
so i just came back had to get diner for the kids. i jumped the gun. it works but the oncloseaction is not saving it. so the alpha changes but on a manual refresh the image goes back to normal.
Code: Select all
ContextTitle2=Set Transparency 125
ContextAction2=[!SetOption MeterCurrentIcon ImageAlpha 125][!UpdateMeter MeterCurrentIcon][!Redraw][!SetVariable MeterCurrentIconAlphaVariable 125]
OnCloseAction2=[!WriteKeyValue Variables MeterCurrentIconAlphaVariable 125 "FileName=#@#WeatherComVariables.inc"]
ContextTitle3=Set Transparency 175
ContextAction3=[!SetOption MeterCurrentIcon ImageAlpha 175][!UpdateMeter MeterCurrentIcon][!Redraw][!SetVariable MeterCurrentIconAlphaVariable 175]
OnCloseAction3=[!WriteKeyValue Variables MeterCurrentIconAlphaVariable 175 "FileName=#@#WeatherComVariables.inc"]
Ok, so first, some "rules":
- OnCloseAction isn't in the form of OnCloseActionN, meaning there is only one OnCloseAction you can have, not OnCloseAction2, OnCloseAction3, etc.
- I don't know if it's a typo or something else, but
Code: Select all
[!WriteKeyValue Variables MeterCurrentIconAlphaVariable 175 "FileName=#@#WeatherComVariables.inc"]
isn't correct - it should simply be
Code: Select all
[!WriteKeyValue Variables MeterCurrentIconAlphaVariable 175 "#@#WeatherComVariables.inc"]
(without the
FileName= stuff)
That being said, when I advised you to do the OnCloseAction thing, I forgot that the [Rainmeter] section doesn't support dynamic variables (i.e. variables that change during a skin "session"), meaning that you can't do what you want from there. Sorry for misleading you, I was thinking at a single (static) value you'd write from there at the time, not a dynamic value.
But, there is a solution, of course - use what you wanted from the start, aka the InputText plugin:
Code: Select all
[Variables]
@Include1=#@#WeatherComVariables.inc
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=47,47,47,255
---Measures---
[MeasureInputText]
Measure=Plugin
Plugin=InputText
X=0
Y=35
W=134
H=44
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,247,255
Padding=5,5,5,5
FontSize=16
AntiAlias=1
ClipString=2
StringAlign=Center
DefaultValue="#MeterCurrentIconAlphaVariable#"
Command1=[!SetOption MeterCurrentIcon ImageAlpha "$UserInput$"][!UpdateMeter MeterCurrentIcon][!Redraw][!SetVariable MeterCurrentIconAlphaVariable [MeasureInputText]][!WriteKeyValue Variables MeterCurrentIconAlphaVariable [MeasureInputText] "#@#WeatherComVariables.inc"]
DynamicVariables=1
---Meters---
[MeterCurrentIcon]
Meter=Image
ImageName="#@#Battery.ico"
ImageAlpha=#MeterCurrentIconAlphaVariable#
X=0
Y=0
DynamicVariables=1
[MeterTest]
Meter=STRING
X=0R
Y=0r
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontSize=16
AntiAlias=1
Text="Test = #MeterCurrentIconAlphaVariable#"
DynamicVariables=1
[MeterInputText]
Meter=STRING
X=65
Y=35
W=130
H=35
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,247,47,255
Padding=5,5,5,5
FontSize=16
AntiAlias=1
ClipString=2
StringAlign=Center
BevelType=2
Text="#MeterCurrentIconAlphaVariable#"
LeftMouseUpAction=[!CommandMeasure MeasureInputText "ExecuteBatch 1"]
DynamicVariables=1
Now, first, I suppose the
WeatherComVariables.inc is already included in your skin - the @Include I have above might be different from yours (since I worked in a simplified test environment), so adapt it to match yours. Secondly, the rest of the things in the
[Rainmeter] section are also specific to this simplified skin, so they might not be necessary in yours.
Naturally, the
ImageName above and the position/dimensions/design of the
[MeasureInputText] and
[MeterInputText] are subject to modification to suit your needs (or to test how this sample works), but you should be aware that the latter two should be for the most part "synchronized", since the InputText plugin based on drawing an "interactive measure" (
[MeasureInputText] in this case) over a static meter (
[MeterInputText] in this case) to simulate the behavior of a "text box".
Hopefully, you'll understand how to integrate the above in your skin. It does what's expected to do:
- it draws a "text box" where you can input your desired value for the image alpha
- when you press Enter in the text box, the value is assigned to the variable and also written in the .inc
- when you load or refresh the skin, the value of the variable is taken from the (previously modified or not) .inc, without the need of a refresh to mess things up
- obviously, the value of the variable you set in the text box (or that you loaded from the .inc through the @Include) will stay in memory as long as the skin is active. When the skin is refreshed or unloaded then loaded again, the value is taken back from the .inc