It is currently April 26th, 2024, 12:43 am

SetVariable problem

Get help with creating, editing & fixing problems with skins
Coolancs
Posts: 6
Joined: October 28th, 2016, 8:41 am

SetVariable problem

Post by Coolancs »

Hello, I'm making a skin and got a little stuck.

I basically grab a value with WebParser and change the color of a skin depending on that.

What i want to do is have a variable that changes depending on that value.
I've tried adding [!Setvariable "Arrow" "↑"] in the IfCondition but i can't seem to make it work.

Thanks in advance!

Code: Select all

[Variables]
Arrow=-

[BTCChange]
Measure=Plugin
Plugin=WebParser
DynamicVariables=1
URL=[GetBTCChange]
StringIndex=1
IfCondition=BTCChange <0
IfTrueAction=[!SetOption MeterBTCChange FontColor "255,0,0,128"][!Redraw]
IfCondition2=BTCChange >0
IfTrueAction2=[!SetOption MeterBTCChange FontColor "0,255,0,128"][!Redraw]
IfCondition3=BTCChange =0
IfTrueAction3=[!SetOption MeterBTCChange FontColor "255,255,255,128"][!Redraw]


[MeterBTCChange]
Update=1000
Meter=String
Text= #Arrow#
X=125r
Y=7r
FontFace=Consolas
FontSize=16
FontColor=0,255,0,128
StringAlign=Left
AntiAlias=1
DynamicVariables=1
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: SetVariable problem

Post by eclectic-tech »

Need a bit more info... :???:

You didn't post the [GetBTCChange] measure for the URL= ... so we don't know what you are trying to parse.

There is no RegExp=(?siU)..., so what are you capturing in StringIndex=1 ?

The WebParser returns STRING values, to use in IfCondition staements, use brackets around the WebParser measure name; [BTCChange]
(Reference: https://docs.rainmeter.net/tips/measure-as-a-variable/)

With a bit more info, someone may be able to determine the issue in your WebParser measure.
BTW your IfCondition statements work fine if given a numeric value... :welcome:
Coolancs
Posts: 6
Joined: October 28th, 2016, 8:41 am

Re: SetVariable problem

Post by Coolancs »

eclectic-tech wrote:Need a bit more info... :???:

You didn't post the [GetBTCChange] measure for the URL= ... so we don't know what you are trying to parse.

There is no RegExp=(?siU)..., so what are you capturing in StringIndex=1 ?

The WebParser returns STRING values, to use in IfCondition staements, use brackets around the WebParser measure name; [BTCChange]
(Reference: https://docs.rainmeter.net/tips/measure-as-a-variable/)

With a bit more info, someone may be able to determine the issue in your WebParser measure.
BTW your IfCondition statements work fine if given a numeric value... :welcome:
Here's the whole skin, i'm trying to change the colored numbers to red=green arrows.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
Arrow=-
#				↑↓

[GetBTCPrice]
Update=1000
Measure=Plugin
Plugin=WebParser
#URL=https://api.coinmarketcap.com/v1/ticker/bitcoin/
#RegExp=price_usd": "(......)
URL=https://api.cryptonator.com/api/ticker/btc-usd
#URL=https://api.cryptonator.com/api/ticker/btc-eur
#URL=https://api.cryptonator.com/api/ticker/btc-gbp
RegExp=price":"(......)

[GetBTCChange]
Update=1000
Measure=Plugin
Plugin=WebParser
#URL=https://api.coinmarketcap.com/v1/ticker/bitcoin/
#RegExp=(?siU)percent_change_1h": "(.*)",.*
URL=https://api.cryptonator.com/api/ticker/btc-usd
RegExp=(?siU)change":"(....)
UpdateRate=10
[GetETHPrice]

Update=1000
Measure=Plugin
Plugin=WebParser
#URL=https://api.coinmarketcap.com/v1/ticker/ethereum/
#RegExp=price_usd": "(....)
URL=https://api.cryptonator.com/api/ticker/eth-usd
#URL=https://api.cryptonator.com/api/ticker/eth-eur
#URL=https://api.cryptonator.com/api/ticker/eth-gbp
RegExp=price":"(....)
[GetETHChange]

Update=1000
Measure=Plugin
Plugin=WebParser
#URL=https://api.coinmarketcap.com/v1/ticker/ethereum/
#RegExp=(?siU)percent_change_1h": "(.*)",.*
URL=https://api.cryptonator.com/api/ticker/eth-usd
RegExp=(?siU)change":"(....)
UpdateRate=10
[GetXMRPrice]

Update=1000
Measure=Plugin
Plugin=WebParser
#URL=https://api.coinmarketcap.com/v1/ticker/monero/
#RegExp=price_usd": "(....)
URL=https://api.cryptonator.com/api/ticker/xmr-usd
#URL=https://api.cryptonator.com/api/ticker/xmr-eur
#URL=https://api.cryptonator.com/api/ticker/xmr-gbp
RegExp=price":"(....)

[GetXMRChange]
Update=1000
Measure=Plugin
Plugin=WebParser
#URL=https://api.coinmarketcap.com/v1/ticker/monero/
#RegExp=(?siU)percent_change_1h": "(.*)",.*
URL=https://api.cryptonator.com/api/ticker/xmr-usd
RegExp=(?siU)change":"(....)
UpdateRate=10

[BTCPrice]
Update=1000
Measure=Plugin
Plugin=WebParser
URL=[GetBTCPRice]
StringIndex=1

[BTCChange]
Measure=Plugin
Plugin=WebParser
DynamicVariables=1

URL=[GetBTCChange]
StringIndex=1
IfCondition=BTCChange <0
IfTrueAction=[!SetOption MeterBTCChange FontColor "255,0,0,128"][!Redraw]
IfCondition2=BTCChange >0
IfTrueAction2=[!SetOption MeterBTCChange FontColor "0,255,0,128"][!Redraw]
IfCondition3=BTCChange =0
IfTrueAction3=[!SetOption MeterBTCChange FontColor "255,255,255,128"][!Redraw]

[ETHPrice]
Update=1000
Measure=Plugin
Plugin=WebParser
URL=[GetETHPrice]
StringIndex=1

[ETHChange]
Measure=Plugin
Plugin=WebParser
URL=[GetETHChange]
StringIndex=1
IfCondition=ETHChange <0
IfTrueAction=[!SetOption MeterETHChange FontColor "255,0,0,128"][!Redraw]
IfCondition2=ETHChange >0
IfTrueAction2=[!SetOption MeterETHChange FontColor "0,255,0,128"][!Redraw]
IfCondition3=ETHChange =0
IfTrueAction3=[!SetOption MeterETHChange FontColor "255,255,255,128"][!Redraw]

[XMRPrice]
Update=1000
Measure=Plugin
Plugin=WebParser
URL=[GetXMRPrice]
StringIndex=1

[XMRChange]
Measure=Plugin
Plugin=WebParser
URL=[GetXMRChange]
StringIndex=1
IfCondition=XMRChange <0
IfTrueAction=[!SetOption MeterXMRChange FontColor "255,0,0,128"][!Redraw]
IfCondition2=XMRChange >0
IfTrueAction2=[!SetOption MeterXMRChange FontColor "0,255,0,128"][!Redraw]
IfCondition3=XMRChange =0
IfTrueAction3=[!SetOption MeterXMRChange FontColor "255,255,255,128"][!Redraw]

[MeterBitcoin]
Group=BTC
Update=1000
Meter=String
FontFace=Consolas
FontSize=24
FontColor=255,255,255,128
SolidColor=0,0,0,1
Padding=0,0,0,0
AntiAlias=1
Text=BTC:

[MeterBTCValue]
Update=1000
Meter=String
MeasureName=BTCPrice
X=80r
FontFace=Consolas
FontSize=24
FontColor=255,255,255,128
StringAlign=Left
AntiAlias=1

[MeterBTCChange]
Update=1000
Meter=String
Text= #Arrow#
X=125r
Y=7r
FontFace=Consolas
FontSize=16
FontColor=0,255,0,128
StringAlign=Left
AntiAlias=1
DynamicVariables=1

[MeterEthereum]
Update=1000
Meter=String
Y=23r
FontFace=Consolas
FontSize=24
FontColor=255,255,255,128
AntiAlias=1
Text=ETH:

[MeterETHValue]
Update=1000
Meter=String
MeasureName=ETHPrice
X=115r
Y=0r
FontFace=Consolas
FontSize=24
FontColor=255,255,255,128
StringAlign=Left
AntiAlias=1

[MeterETHChange]
Update=1000
Meter=String
MeasureName=ETHChange
X=90r
Y=7r
FontFace=Consolas
FontSize=16
FontColor=0,255,0,128
StringAlign=Left
AntiAlias=1

[MeterMonero]
Update=1000
Meter=String
Y=23r
FontFace=Consolas
FontSize=24
FontColor=255,255,255,128
AntiAlias=1
Text=XMR:

[MeterXMRValue]
Update=1000
Meter=String
MeasureName=XMRPrice
X=115r
Y=0r
FontFace=Consolas
FontSize=24
FontColor=255,255,255,128
StringAlign=Left
AntiAlias=1

[MeterXMRChange]
Update=1000
Meter=String
MeasureName=XMRChange
X=90r
Y=7r
FontFace=Consolas
FontSize=16
FontColor=0,255,0,128
StringAlign=Left
AntiAlias=1
Last edited by Coolancs on March 2nd, 2017, 7:24 pm, edited 1 time in total.
Coolancs
Posts: 6
Joined: October 28th, 2016, 8:41 am

Re: SetVariable problem

Post by Coolancs »

Coolancs wrote:Here's the whole skin, i'm trying to change the colored numbers to red=green arrows.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
Arrow=-
#				↑↓

[GetBTCPrice]
Update=1000
Measure=Plugin
Plugin=WebParser
#URL=https://api.coinmarketcap.com/v1/ticker/bitcoin/
#RegExp=price_usd": "(......)
URL=https://api.cryptonator.com/api/ticker/btc-usd
#URL=https://api.cryptonator.com/api/ticker/btc-eur
#URL=https://api.cryptonator.com/api/ticker/btc-gbp
RegExp=price":"(......)

[GetBTCChange]
Update=1000
Measure=Plugin
Plugin=WebParser
#URL=https://api.coinmarketcap.com/v1/ticker/bitcoin/
#RegExp=(?siU)percent_change_1h": "(.*)",.*
URL=https://api.cryptonator.com/api/ticker/btc-usd
RegExp=(?siU)change":"(....)
UpdateRate=10
[GetETHPrice]

Update=1000
Measure=Plugin
Plugin=WebParser
#URL=https://api.coinmarketcap.com/v1/ticker/ethereum/
#RegExp=price_usd": "(....)
URL=https://api.cryptonator.com/api/ticker/eth-usd
#URL=https://api.cryptonator.com/api/ticker/eth-eur
#URL=https://api.cryptonator.com/api/ticker/eth-gbp
RegExp=price":"(....)
[GetETHChange]

Update=1000
Measure=Plugin
Plugin=WebParser
#URL=https://api.coinmarketcap.com/v1/ticker/ethereum/
#RegExp=(?siU)percent_change_1h": "(.*)",.*
URL=https://api.cryptonator.com/api/ticker/eth-usd
RegExp=(?siU)change":"(....)
UpdateRate=10
[GetXMRPrice]

Update=1000
Measure=Plugin
Plugin=WebParser
#URL=https://api.coinmarketcap.com/v1/ticker/monero/
#RegExp=price_usd": "(....)
URL=https://api.cryptonator.com/api/ticker/xmr-usd
#URL=https://api.cryptonator.com/api/ticker/xmr-eur
#URL=https://api.cryptonator.com/api/ticker/xmr-gbp
RegExp=price":"(....)

[GetXMRChange]
Update=1000
Measure=Plugin
Plugin=WebParser
#URL=https://api.coinmarketcap.com/v1/ticker/monero/
#RegExp=(?siU)percent_change_1h": "(.*)",.*
URL=https://api.cryptonator.com/api/ticker/xmr-usd
RegExp=(?siU)change":"(....)
UpdateRate=10

[BTCPrice]
Update=1000
Measure=Plugin
Plugin=WebParser
URL=[GetBTCPRice]
StringIndex=1

[BTCChange]
Measure=Plugin
Plugin=WebParser
DynamicVariables=1

URL=[GetBTCChange]
StringIndex=1
IfCondition=BTCChange <0
IfTrueAction=[!SetOption MeterBTCChange FontColor "255,0,0,128"][!Redraw]
IfCondition2=BTCChange >0
IfTrueAction2=[!SetOption MeterBTCChange FontColor "0,255,0,128"][!Redraw]
IfCondition3=BTCChange =0
IfTrueAction3=[!SetOption MeterBTCChange FontColor "255,255,255,128"][!Redraw]

[ETHPrice]
Update=1000
Measure=Plugin
Plugin=WebParser
URL=[GetETHPrice]
StringIndex=1

[ETHChange]
Measure=Plugin
Plugin=WebParser
URL=[GetETHChange]
StringIndex=1
IfCondition=ETHChange <0
IfTrueAction=[!SetOption MeterETHChange FontColor "255,0,0,128"][!Redraw]
IfCondition2=ETHChange >0
IfTrueAction2=[!SetOption MeterETHChange FontColor "0,255,0,128"][!Redraw]
IfCondition3=ETHChange =0
IfTrueAction3=[!SetOption MeterETHChange FontColor "255,255,255,128"][!Redraw]

[XMRPrice]
Update=1000
Measure=Plugin
Plugin=WebParser
URL=[GetXMRPrice]
StringIndex=1

[XMRChange]
Measure=Plugin
Plugin=WebParser
URL=[GetXMRChange]
StringIndex=1
IfCondition=XMRChange <0
IfTrueAction=[!SetOption MeterXMRChange FontColor "255,0,0,128"][!Redraw]
IfCondition2=XMRChange >0
IfTrueAction2=[!SetOption MeterXMRChange FontColor "0,255,0,128"][!Redraw]
IfCondition3=XMRChange =0
IfTrueAction3=[!SetOption MeterXMRChange FontColor "255,255,255,128"][!Redraw]

[MeterBitcoin]
Group=BTC
Update=1000
Meter=String
FontFace=Consolas
FontSize=24
FontColor=255,255,255,128
SolidColor=0,0,0,1
Padding=0,0,0,0
AntiAlias=1
Text=BTC:

[MeterBTCValue]
Update=1000
Meter=String
MeasureName=BTCPrice
X=80r
FontFace=Consolas
FontSize=24
FontColor=255,255,255,128
StringAlign=Left
AntiAlias=1

[MeterBTCChange]
Update=1000
Meter=String
Text= #Arrow#
X=125r
Y=7r
FontFace=Consolas
FontSize=16
FontColor=0,255,0,128
StringAlign=Left
AntiAlias=1
DynamicVariables=1

[MeterEthereum]
Update=1000
Meter=String
Y=23r
FontFace=Consolas
FontSize=24
FontColor=255,255,255,128
AntiAlias=1
Text=ETH:

[MeterETHValue]
Update=1000
Meter=String
MeasureName=ETHPrice
X=115r
Y=0r
FontFace=Consolas
FontSize=24
FontColor=255,255,255,128
StringAlign=Left
AntiAlias=1

[MeterETHChange]
Update=1000
Meter=String
MeasureName=ETHChange
X=90r
Y=7r
FontFace=Consolas
FontSize=16
FontColor=0,255,0,128
StringAlign=Left
AntiAlias=1

[MeterMonero]
Update=1000
Meter=String
Y=23r
FontFace=Consolas
FontSize=24
FontColor=255,255,255,128
AntiAlias=1
Text=XMR:

[MeterXMRValue]
Update=1000
Meter=String
MeasureName=XMRPrice
X=115r
Y=0r
FontFace=Consolas
FontSize=24
FontColor=255,255,255,128
StringAlign=Left
AntiAlias=1

[MeterXMRChange]
Update=1000
Meter=String
MeasureName=XMRChange
X=90r
Y=7r
FontFace=Consolas
FontSize=16
FontColor=0,255,0,128
StringAlign=Left
AntiAlias=1
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: SetVariable problem

Post by eclectic-tech »

Your code is working for me, the values are changing. I may have misunderstood what you wanted...
To have a colored arrow I changed your variables and added an additional SetOption to your IfConditions...

Code: Select all

[Variables]
Arrow=-
ArrowUp=↑
ArrowDown=↓

...

[BTCChange]
Measure=Plugin
Plugin=WebParser
DynamicVariables=1

URL=[GetBTCChange]
StringIndex=1
IfCondition=BTCChange <0
IfTrueAction=[!SetOption MeterBTCChange FontColor "255,0,0,128"][!SetOption MeterBTCChange Text "#ArrowDown#"][!Redraw]
IfCondition2=BTCChange >0
IfTrueAction2=[!SetOption MeterBTCChange FontColor "0,255,0,128"][!SetOption MeterBTCChange Text "#ArrowUp#"][!Redraw]
IfCondition3=BTCChange =0
IfTrueAction3=[!SetOption MeterBTCChange FontColor "255,255,255,128"][!SetOption MeterBTCChange Text "#Arrow#"][!Redraw]

I hope this is close to what you were trying to accomplish.
BTC.png
You do not have the required permissions to view the files attached to this post.
Coolancs
Posts: 6
Joined: October 28th, 2016, 8:41 am

Re: SetVariable problem

Post by Coolancs »

eclectic-tech wrote:Your code is working for me, the values are changing. I may have misunderstood what you wanted...
To have a colored arrow I changed your variables and added an additional SetOption to your IfConditions...
I didn't know how to change the arrows, but this works perfectly. Thank you! :D