Hello, guys,
I hope you can help me.
I have written a meter that can be extendet in two ways. (by click)
But when you open both things at the same time, they overlap.
So I wanted to write an if statement that if both meters are open, a
variable changes so that they are again next to each other.
I would like to show and explain my code:
cpuHidden is a variable that =1 if the meter"CPU" is closed.
Analogously ramHidden with the meter "RAM".
cpuHiddenPositionX is the x-variable of the CPU meter(by default "#monitorWidth#-420" (just like the RAM window)
But with "cpuHiddenPositionX=#monitorWidth#-620" the windows wouldn't overlap any more
Now here's my code:
The if statement and how I call it and a example meter to draw:
//If
[iMoveCPU]
IfCondition = (ramHidden = 0)
IfTrueAction = [!SetVariable "cpuHiddenPositionX" "(#monitorWidth#-620)"][!Redraw]
IfFalseAction = [!SetVariable "cpuHiddenPositionX" "(#monitorWidth#-420)"][!Redraw]
Disabled = 1
//Call
LeftMouseDownAction = [!ToggleMeterGroup "HiddenCPU"],[iMoveCPU]
// one meter with cpuHiddenPositionX as variable
[pCPU0]
Meter = String
Group = HiddenCPU
MeasureName = mCPU0
MeterStyle = Style01
Text = "Core #0: %1%"
y = #cpuHiddenPositionY#
x = #cpuHiddenPositionX#
Hidden = 1
DynamicVariables = 2
I have no idea why it doesn't work please help me
It is currently April 18th, 2024, 11:44 am
Help with If and !SetVariable
-
- Posts: 2
- Joined: November 18th, 2017, 12:33 am
Help with If and !SetVariable
Last edited by LazyLaubert on November 18th, 2017, 4:16 pm, edited 1 time in total.
-
- Posts: 908
- Joined: December 30th, 2015, 9:47 am
Re: Help with If and !SetVariable
Just a quick look...
1. IfCondition expression must be within a measure. So, [iMoveCPU] lacks "Measure=" definition header. If you want this IfCondition run always with no condition, you can insert following 2 lines.
2. Why disabled [iMoveCPU]? Is this section is enabled somewhere in the skin?
3. In Rainmeter, "comment-out" character is ";", not "//", I think.
4. DynamicVariables option must be 0 or 1.
1. IfCondition expression must be within a measure. So, [iMoveCPU] lacks "Measure=" definition header. If you want this IfCondition run always with no condition, you can insert following 2 lines.
Code: Select all
Measure=Calc
Formula=1
3. In Rainmeter, "comment-out" character is ";", not "//", I think.
4. DynamicVariables option must be 0 or 1.
-
- Rainmeter Sage
- Posts: 16143
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Help with If and !SetVariable
Sorry, but not absolutely necessary. In fact I think 0 means the dynamic variables aren't set, but 1 or any greater value means they are.mak_kawa wrote:4. DynamicVariables option must be 0 or 1.
Any larger value then 0 usually means true, zero means false in the logical expressions (at least as far as I know).
Try to create a simple meter which has to have set the dynamic variables and instead of adding it the DyanmicVariables=1 option, add DyanmicVariables=2 (or a greater value). You'll see it's perfectly working and doesn't even returns a error message in the log.
-
- Rainmeter Sage
- Posts: 16143
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Help with If and !SetVariable
mak_kawa had good observations, however I think a bit different approach also exists. Although I don't know the whole code, I have the impression that the meters could be positioned relatively to each other, this way avoiding the need of using the cpuHiddenPositionX variable.LazyLaubert wrote:But when you open both things at the same time, they overlap.
Posting the whole code (using the
Code: Select all
-
- Posts: 2
- Joined: November 18th, 2017, 12:33 am
Re: Help with If and !SetVariable
Thank you guys!
I'll try it the way that mak_kawa has told me!
#######################################################################################
Update:
I finally made it
The problems i had to solve are:
-the missing Measure=Calc and Formula=1 also
- Disabled = 1 was wrong
- missing # -> #ramHidden# (!)
- missing DynamicVariables = 1 in [iMoveCPU]
- no [!Redraw] in [iMoveCPU]!
-missing [!Update] in the Call
-[iMoveCPU] in call is unnesessary
I'll try it the way that mak_kawa has told me!
#######################################################################################
Update:
I finally made it
The problems i had to solve are:
-the missing Measure=Calc and Formula=1 also
- Disabled = 1 was wrong
- missing # -> #ramHidden# (!)
- missing DynamicVariables = 1 in [iMoveCPU]
- no [!Redraw] in [iMoveCPU]!
-missing [!Update] in the Call
-[iMoveCPU] in call is unnesessary