It is currently May 1st, 2024, 11:39 am

How to create a variable which calculate several values?

Get help with creating, editing & fixing problems with skins
User avatar
lysy1993lbn
Posts: 291
Joined: July 25th, 2011, 9:53 am
Location: Lublin, Poland

How to create a variable which calculate several values?

Post by lysy1993lbn »

I don't know how to ask this to make it clear to understand so i'll do it example-like..

I have created skin which GUI base is "controlled" by Rainmeter (by image tile)
Something like that
[BgrTop]
Meter=Image
ImageName=$GUI\bg_top

[BgrMid]
Meter=Image
ImageName=$GUI\bg_mid
Y=62r
H=#BGHEIGHT#
W=372
Tile=1

[BgrBot]
Meter=Image
ImageName=$GUI\bg_bot
Y=#BGHEIGHT#r
It also have blur variable described
[Rainmeter]
Blur=1
BlurRegion=2,0,0,375,(#BGHEIGHT#+74),20
DynamicWindowSize=1
I need some kind of "global calc" which will set that #BGHEIGHT# depending of several variables like number of HDD's set by user in variables file..

I mean that if user sets:
HDD=1
that will gain for example 60 to output value of #BGHEIGHT#
if HDD=2 will gain 120 etc..
It will also depend of another user setting
GPUMonitoring=1 (enabled, gain 60) or 0 (disabled, gain nothing)

So i thought to create it by calculating like:
450 (main, forced height) + 60*#2# (Number of HDD's) + #GPUvar# (that one coud have variable in @include file becouse 0 in GPUMonitoring will disable it with all meters and measures)

And I don't know how to do that so it will "support" blur and everything else..

Preview of skin in my signature if needed..

Sorry for my bad english, hope You'll understand what i mean..
"Never argue with an idiot, he will drag you down to his level and beat you with experience."
my deviantART | Alternative Rainmeter tray icons
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: How to create a variable which calculate several values?

Post by Brian »

Dynamic Variables are not supported in the [Rainmeter] section of a skin, so if you use a variable that changes, it will not be changed in the [Rainmeter] section, it will remain to be the original value.

However, there a couple of bangs that will allow you add (or show) blur to a region, or remove (or hide) blur from a region.

-Brian
User avatar
lysy1993lbn
Posts: 291
Joined: July 25th, 2011, 9:53 am
Location: Lublin, Poland

Re: How to create a variable which calculate several values?

Post by lysy1993lbn »

That current one

Code: Select all

[Rainmeter]
Blur=1
BlurRegion=2,0,0,375,(#BGHEIGHT#+74),20
DynamicWindowSize=1
Works well

Could You just tell me which way should I do calcculation?
calc measure or something else?

Is it possible to do something like
[Measure]
Measure=Calc
Formula=whatever
*don't know how to explain it*=!setoption variables BGHEIGHT [measure output here]
"Never argue with an idiot, he will drag you down to his level and beat you with experience."
my deviantART | Alternative Rainmeter tray icons
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: How to create a variable which calculate several values?

Post by Brian »

Yes the Calc measure is what you need.

(Not sure if I am reading your first post correctly)

Code: Select all

[SomeMeasureName]
Measure=Calc
Formula=#HDD#
IfAboveValue=1
IfAboveAction=!SetVariable BGHEIGHT (450+(60*#HDD#)+#GPUvar#)
Remember to add "DynamicVariables=1" to each measure/meter that uses BGHEIGHT.

Depending on your code, you might be able to just set in the [Variables] section, like this:
BGHEIGHT=(450+(60*#HDD#)+#GPUvar#)

-Brian
User avatar
lysy1993lbn
Posts: 291
Joined: July 25th, 2011, 9:53 am
Location: Lublin, Poland

Re: How to create a variable which calculate several values?

Post by lysy1993lbn »

Brian wrote:Yes the Calc measure is what you need.

(Not sure if I am reading your first post correctly)

Code: Select all

[SomeMeasureName]
Measure=Calc
Formula=#HDD#
IfAboveValue=1
IfAboveAction=!SetVariable BGHEIGHT (450+(60*#HDD#)+#GPUvar#)
Remember to add "DynamicVariables=1" to each measure/meter that uses BGHEIGHT.

Depending on your code, you might be able to just set in the [Variables] section, like this:
BGHEIGHT=(450+(60*#HDD#)+#GPUvar#)

-Brian
Just tried something like that before You post it and it surprisingly works well! Thanks :)

I'll ask nother question to not create another thread..
Is it possible to introduce into Rainmeter something like nul which will set empty value?

For example to use with indicator of process.. something like:
[Process1]
Measure=Plugin
Plugin=Process
ProcessName=#Process1#
Substitute="-1":"nul","1":"run.png"

For now I have to create additional "empty" image, otherwise getting "Error" messages in log all the time

That "nul" value would tell Rainmeter to not look anywhere..

I know that it could be "solved" by ifaboveaction etc. options, but why to add 4 additional lines if it could be just like above..
"Never argue with an idiot, he will drag you down to his level and beat you with experience."
my deviantART | Alternative Rainmeter tray icons
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: How to create a variable which calculate several values?

Post by Brian »

There is no "null" value within a Rainmeter skin, but you could either use an image that is transparent.
(ie. Substitute="-1":"transparent.png","1":"run.png")

Or, just use an "empty" substitute, however this may give you problems depending on your code.
Substitute="-1":"","1":"run.png"

-Brian

Edit: I guess you have already tried these. (I need to read more carefully.) :)
User avatar
lysy1993lbn
Posts: 291
Joined: July 25th, 2011, 9:53 am
Location: Lublin, Poland

Re: How to create a variable which calculate several values?

Post by lysy1993lbn »

Yeah.. i know that, i have that transparent image now..
And

Code: Select all

Substitute="-1":"","1":"run.png"
also cause "image not found" errors in log.

But that "nul" or "null" value would be useful also in several different cases..
Please add aomething like that to Rainmeter if it isn't too hard
"Never argue with an idiot, he will drag you down to his level and beat you with experience."
my deviantART | Alternative Rainmeter tray icons
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: How to create a variable which calculate several values?

Post by Brian »

I really don't think there is a need for this. There would have to be significant change to the code to account for "null" values.

The "transparent.png" method is sufficient to solve your issue.

-Brian
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How to create a variable which calculate several values?

Post by jsmorley »

Actually,

Substitute="-1":"","1":"run.png" should be fine.

[MeterSomeImage]
Meter=Image
ImageName=

or

[MeterSomeImage]
Meter=Image
ImageName=""

Do not cause any error in the log.
User avatar
lysy1993lbn
Posts: 291
Joined: July 25th, 2011, 9:53 am
Location: Lublin, Poland

Re: How to create a variable which calculate several values?

Post by lysy1993lbn »

Actually it does..
Image
Latest beta Rainmeter
"Never argue with an idiot, he will drag you down to his level and beat you with experience."
my deviantART | Alternative Rainmeter tray icons