It is currently November 14th, 2019, 7:55 am

[Newby on Rainmeter Laguage] - IF CONDITION IS MEET -> CHANGE VAR VALUE

Help with creating, editing & fixing problems with skins
Qüeon
Posts: 2
Joined: June 12th, 2019, 3:01 pm

[Newby on Rainmeter Laguage] - IF CONDITION IS MEET -> CHANGE VAR VALUE

Qüeon » June 12th, 2019, 3:10 pm

Hello Rainmeter community,
so I'm a developer tho I'm really new to Rainmeter and C++ since my main projects work in Java and C#.
I was trying to personalize a RSS Feed with 3 tabs, Recent News, Sports and Technology and I want to assign
a different RSS URL for each (of course bruh). The problem is I can't understand how...

The script has a selected variable that is meat to be set 1, 2 or 3 depending on what tab is active, like this one:
LeftMouseUpAction=[!SetVariable topic "WORLD"][!SetVariable selected 1][!CommandMeasure GoogleRSSFeed "Update"]

And what I want is, back on the main object I want url variable to change depending on "selected" variable, something that would look like this in C

if(selected==1){
url="some_thing_1";
}
if(selected==2){
url="some_thing_2";
}

I've tried some solutions also read the readmeter "ifcondition" -> "iftrueaction" posts but I can't figure it out.
Any one can help me?
User avatar
balala
Rainmeter Sage
Posts: 9039
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Newby on Rainmeter Laguage] - IF CONDITION IS MEET -> CHANGE VAR VALUE

balala » June 12th, 2019, 3:43 pm

Probably you should have to set the URL according to the actual value of the selected variable, through a Calc measure. So, try to add the following measure to your code:

Code: Select all

[MeasureSelected]
Measure=Calc
Formula=#selected#
IfCondition=(#CURRENTSECTION#=1)
IfTrueAction=[!SetOption ParentWebParserMeasure URL "FIRST-URL"][!UpdateMeasure "ParentWebParserMeasure"][!CommandMeasure "ParentWebParserMeasure" "Update"]
IfCondition2=(#CURRENTSECTION#=2)
IfTrueAction2=[!SetOption ParentWebParserMeasure URL "SECOND-URL"][!UpdateMeasure "ParentWebParserMeasure"][!CommandMeasure "ParentWebParserMeasure" "Update"]
IfCondition3=(#CURRENTSECTION#=3)
IfTrueAction3=[!SetOption ParentWebParserMeasure URL "THIRD-URL"][!UpdateMeasure "ParentWebParserMeasure"][!CommandMeasure "ParentWebParserMeasure" "Update"]
DynamicVariables=1
Note the followings:
  • Replace the ParentWebParserMeasure measure name with the correct one. Take a look at your code and identify the parent WebParser measure. It's the one which has a Measure=WebParser option (or if it's an older code a Measure=Plugin and a Plugin=WebParser options) AND the URL option (set to certain URL). In the above code replace the ParentWebParserMeasure name with its name.
  • As you probably have figured it out, in the above code you have to replace the FIRST-URL, SECOND-URL and THIRD-URL with the appropriate URLs you want to use.
If you can't get this to work, please post a code of the skin, or even better a link where we can download the skin.
Qüeon
Posts: 2
Joined: June 12th, 2019, 3:01 pm

Re: [Newby on Rainmeter Laguage] - IF CONDITION IS MEET -> CHANGE VAR VALUE

Qüeon » June 13th, 2019, 10:22 am

balala wrote:
June 12th, 2019, 3:43 pm
Probably you should have to set the URL according to the actual value of the selected variable, through a Calc measure. So, try to add the following measure to your code:

Code: Select all

[MeasureSelected]
Measure=Calc
Formula=#selected#
IfCondition=(#CURRENTSECTION#=1)
IfTrueAction=[!SetOption ParentWebParserMeasure URL "FIRST-URL"][!UpdateMeasure "ParentWebParserMeasure"][!CommandMeasure "ParentWebParserMeasure" "Update"]
IfCondition2=(#CURRENTSECTION#=2)
IfTrueAction2=[!SetOption ParentWebParserMeasure URL "SECOND-URL"][!UpdateMeasure "ParentWebParserMeasure"][!CommandMeasure "ParentWebParserMeasure" "Update"]
IfCondition3=(#CURRENTSECTION#=3)
IfTrueAction3=[!SetOption ParentWebParserMeasure URL "THIRD-URL"][!UpdateMeasure "ParentWebParserMeasure"][!CommandMeasure "ParentWebParserMeasure" "Update"]
DynamicVariables=1
Note the followings:
  • Replace the ParentWebParserMeasure measure name with the correct one. Take a look at your code and identify the parent WebParser measure. It's the one which has a Measure=WebParser option (or if it's an older code a Measure=Plugin and a Plugin=WebParser options) AND the URL option (set to certain URL). In the above code replace the ParentWebParserMeasure name with its name.
  • As you probably have figured it out, in the above code you have to replace the FIRST-URL, SECOND-URL and THIRD-URL with the appropriate URLs you want to use.
If you can't get this to work, please post a code of the skin, or even better a link where we can download the skin.
Thank you so much I'll give it a try asap and come with feedback, when I get it right I want to post the skin (I'm actually preety proud of what I done so far eheheh) thanks once more!
User avatar
balala
Rainmeter Sage
Posts: 9039
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Newby on Rainmeter Laguage] - IF CONDITION IS MEET -> CHANGE VAR VALUE

balala » June 13th, 2019, 12:07 pm

Qüeon wrote:
June 13th, 2019, 10:22 am
Thank you so much I'll give it a try asap and come with feedback, when I get it right I want to post the skin (I'm actually preety proud of what I done so far eheheh) thanks once more!
Ok, give it. I am curious if it does work. As I said, if it doesn't, just post the whole code, or pack the config and upload it.