It is currently September 29th, 2024, 7:29 pm

Some Interesting Issues with DynamicVariables & !SetOption

General topics related to Rainmeter.
User avatar
XANCI
Posts: 104
Joined: September 18th, 2011, 6:37 am
Location: Nanjing, China

Some Interesting Issues with DynamicVariables & !SetOption

Post by XANCI »

First check this:

Code: Select all

[Variables]
Alpha=255

[b]
Meter=IMAGE
W=200
H=100
SolidColor=0,0,0
LeftMouseUpAction=!Execute [!SetVariable Alpha (255-#Alpha#)][!Update]
RightMouseUpAction=!Execute [!SetVariable Alpha (255-#Alpha#)][!SetOption 2 W 100][!Update]
DynamicVariables=1

[1]
Meter=IMAGE
W=100
H=100
SolidColor=255,255,255,#Alpha#
DynamicVariables=1

[2]
Meter=IMAGE
X=R
W=100
H=100
SolidColor=255,255,255,#Alpha#
There are two white block over a black background, when you left-click the skin, the variable #Alpha# switch between 255 and 0. Note that only the first block has "DynamicVariables=1" with it, so when you left-click the skin, the second block won't change. The RightMouseUpAction added a !SetOption Bang which should actually makes no changes to the second block, but now it act the same as the first block.
This doesn't means a !SetOption will enable "DynamicVariables=1", since if you left-click after a right-click, the second block won't change again. In my opinion, !SetOption will "Update" the target Meter's options with the current variables in spite of the DynamicVariables setting.
poiru
Developer
Posts: 2873
Joined: April 17th, 2009, 12:18 pm

Re: Some Interesting Issues with DynamicVariables & !SetOpti

Post by poiru »

This is by design. If DynamicVariables=1 is not set on the targer of !SetOption, it will be enabled for 1 update cycle.
Asagrim
Posts: 126
Joined: August 12th, 2011, 12:30 pm

Re: Some Interesting Issues with DynamicVariables & !SetOpti

Post by Asagrim »

I do have an issue with !SetOption, and after searching, this is the thread i found mostly related to my issue.

I have a code (it is mostly from Activedock by jsmorley)

Code: Select all

[Rainmeter]
Update=200

[MeterApp11]
Meter=Image
X=4r
Y=4r
W=32
H=32
ImageName=Icons\#Img11#
ImageAlpha=210
ImageTint=255,255,255,190
GreyScale=1
MouseOverAction=!SetOption #CURRENTSECTION# ImageAlpha 255
MouseLeaveAction=!SetOption #CURRENTSECTION# ImageAlpha 210
LeftMouseUpAction=!Execute ["#App11#"]
;DynamicVariables=1

[MeterGlow11]
Meter=Image
X=-4r
Y=32r
W=40
H=4
SolidColor=0,255,0,160
UpdateDivider=86400
Hidden=1
So far so good. Now i have two versions that modify the look of MeterApp11, depending on whether the program is running or not.

BOTH versions work as intended (despite having read that SetOption can't change X Y values), but the !SetOption parts work for one update cycle only.

Code: Select all

[MeasurePID11]
Measure=Plugin
Plugin=Process.dll
ProcessName=#Proc11#
UpdateDivider=2
IfBelowValue=1
IfBelowAction=[!HideMeter MeterGlow11][!SetOption MeterApp11 Y r]
IfAboveValue=0
IfAboveAction=[!ShowMeter MeterGlow11][!SetOption MeterApp11 Y 4r]

[MeasurePID11]
Measure=Plugin
Plugin=Process.dll
ProcessName=#Proc1#
IfBelowValue=1
IfBelowAction=[!SetOption MeterApp1 GreyScale 1]
IfAboveValue=0
IfAboveAction=[!SetOption MeterApp1 GreyScale ""]
I have tried a dozen small modifications, the issue seems to be with SetOption itself. DynamicVariables has no effect whatsoever. What might be the problem? (I am using the 2.5.0 beta r1819 64-bit version of Rainmeter.)

Thanks!

EDIT: Wrong paste, sorry! It's now SetOption, and the actual code i have the problem with.
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Some Interesting Issues with DynamicVariables & !SetOpti

Post by jsmorley »

I don't really understand the issue. If the application is running, then the IfAboveAction will fire (once... that is how IfActions work) and show the meter and change the position values on the other meter. The first meter will stay shown and the second one positioned that way until the application is not running, when the IfBelowAction will fire, hide the first meter, and change the position of the other meter.
Asagrim
Posts: 126
Joined: August 12th, 2011, 12:30 pm

Re: Some Interesting Issues with DynamicVariables & !SetOpti

Post by Asagrim »

I don't understand it either, even if i remove the Y parameter so it will only exist in memory set by !SetOption, i have the program running, i refresh rainmeter, and it initially fires for one update cycle (Y=4r, the program is running, IfAboveAction is true), but then goes back to the other state the next update cycle (Y=r). In the meanwhile HideMeter and Showmeter work just fine and don't change states as long as the program is running.
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Some Interesting Issues with DynamicVariables & !SetOpti

Post by jsmorley »

Not sure what you are seeing. This code works fine for me, shows the "glow" meter and moves the second meter in relation to the first if Notepad.exe is running and hides the "glow" and moves the second meter back to the original position if it isn't.

DynamicVariables are never an issue with !SetOption, as it in effect turns on DynamicVariables on the target section for one update, sets the value (permanently, unless you change it again or refresh) and then turns off DynamicVariables.

Code: Select all

[Rainmeter]
Update=1000

[MeasurePID11]
Measure=Plugin
Plugin=Process.dll
ProcessName=Notepad.exe
UpdateDivider=2
IfBelowValue=1
IfBelowAction=[!HideMeter MeterGlow11][!SetOption MeterApp11 Y R]
IfAboveValue=0
IfAboveAction=[!ShowMeter MeterGlow11][!SetOption MeterApp11 Y 4R]


[MeterApp10]
Meter=Image
W=50
H=50
SolidColor=0,255,0,255

[MeterApp11]
Meter=Image
Y=R
W=50
H=50
SolidColor=0,0,255,255

[MeterGlow11]
Meter=Image
X=40r
Y=40r
W=5
H=5
SolidColor=255,255,255,255
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Some Interesting Issues with DynamicVariables & !SetOpti

Post by jsmorley »

Now that I look closer at your code, I wonder if the issue isn't that you have two instances of a process plugin measure looking at the same executable, and both using !SetOption to set some value on the same meter.

Code: Select all

[MeasurePID11]
Measure=Plugin
Plugin=Process.dll
ProcessName=#Proc11#
UpdateDivider=2
IfBelowValue=1
IfBelowAction=[!HideMeter MeterGlow11][!SetOption MeterApp11 Y r]
IfAboveValue=0
IfAboveAction=[!ShowMeter MeterGlow11][!SetOption MeterApp11 Y 4r]

[MeasurePID11]
Measure=Plugin
Plugin=Process.dll
ProcessName=#Proc1#
IfBelowValue=1
IfBelowAction=[!SetOption MeterApp1 GreyScale 1]
IfAboveValue=0
IfAboveAction=[!SetOption MeterApp1 GreyScale ""]
It might be that the two !SetOption calls are stepping on each other. In other words, when the second one happens, (the GreyScale) the setting of DynamicVariables for one update is causing the meter to revert to the original value from the ones set by the first !SetOption.

Try doing everything in one process plugin measure, with one set of IFActions that just do all the work at once.

Code: Select all

[MeasurePID11]
Measure=Plugin
Plugin=Process.dll
ProcessName=#Proc11#
UpdateDivider=2
IfBelowValue=1
IfBelowAction=[!HideMeter MeterGlow11][!SetOption MeterApp11 Y r][!SetOption MeterApp1 GreyScale 1]
IfAboveValue=0
IfAboveAction=[!ShowMeter MeterGlow11][!SetOption MeterApp11 Y 4r][!SetOption MeterApp1 GreyScale ""]
Asagrim
Posts: 126
Joined: August 12th, 2011, 12:30 pm

Re: Some Interesting Issues with DynamicVariables & !SetOpti

Post by Asagrim »

jsmorley wrote:Not sure what you are seeing.
Let's take the more simple example, GreyScale.

With this code:

Code: Select all

[Rainmeter]
Update=200

[MeterApp1]
Meter=Image
X=4r
Y=4r
W=32
H=32
ImageName=Icons\#Img1#
ImageAlpha=210
MouseOverAction=!SetOption #CURRENTSECTION# ImageAlpha 255
MouseLeaveAction=!SetOption #CURRENTSECTION# ImageAlpha 210
LeftMouseUpAction=!Execute ["#App1#"]

[MeasurePID1]
Measure=Plugin
Plugin=Process.dll
ProcessName=#Proc1#
IfBelowValue=1
IfBelowAction=[!SetOption MeterApp1 GreyScale 1]
IfAboveValue=0
IfAboveAction=[!SetOption MeterApp1 GreyScale 0]
I see this:

http://www.youtube.com/watch?v=Kks87sHG4wk

Everything works, except the GreyScale set by SetOption reverts back the next update cycle, as if the program wasn't running. I have no clue why this happens, because GreyScale is created by SetOption, which should not change as long the program is running.

The moving and greyscale were just two separate instances of what i wanted to do. When i failed with one, i moved to another, and experienced the same issue. There is only one IfAction present at all times.
Last edited by Asagrim on May 11th, 2013, 2:17 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Some Interesting Issues with DynamicVariables & !SetOpti

Post by jsmorley »

In fact, you have two measures with the same name, that is going to cause errors for sure...
Asagrim
Posts: 126
Joined: August 12th, 2011, 12:30 pm

Re: Some Interesting Issues with DynamicVariables & !SetOpti

Post by Asagrim »

jsmorley wrote:In fact, you have two measures with the same name, that is going to cause errors for sure...
Two separate examples, that's why i separated them. These are two things i wanted to make independently, both times i ended up with misbehaving setoptions.