It is currently May 4th, 2024, 5:19 am

[SOLVED] Change a StringIndex Value Every 5 Minutes

Get help with creating, editing & fixing problems with skins
User avatar
ScoobSTi
Posts: 127
Joined: September 12th, 2012, 10:49 pm

[SOLVED] Change a StringIndex Value Every 5 Minutes

Post by ScoobSTi »

Is this possible? I know I'll need a Calc measure, but can it actually change a StringIndex value? I'm rubbish at math in Rainmeter, and the tutorials are confusing for me. :(
Last edited by ScoobSTi on December 9th, 2012, 5:25 pm, edited 4 times in total.
Image
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Change a StringIndex Value Every 5 Minutes

Post by eclectic-tech »

Yes it is possible. You need to write the change to an included variable file, and then refresh the skin because the WebParser plugin is not dynamic.

This example assumes a variable.inc file in the @Resources folder, with a StringIndexNumber variable defined in the [Variables] section...

Code: Select all

[Rainmeter]
Update=1000

[Variables]
@include=#@#variables.inc

[mStations]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL="..."
RegExp=(?siU)(.*)\r.*

[mStation1Link]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL=[mStations]
StringIndex=#StringIndexNumber#

[mCounter]
Measure=Calc
Formula=(mCounter%300)+1
IfEqualValue=300
IfEqualAction=[!WriteKeyValue Variables StringIndexNumber NewStringIndexNumber "#@#variables.inc"][!Refresh]
You can also look at the code of my I-Radio skin which uses a similar action and uses a formula in the actual StringIndex= line...
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Change a StringIndex Value Every 5 Minutes

Post by smurfier »

There's also the method for doing this dynamically without having to refresh the skin.

Code: Select all

[Rainmeter]
Update=1000

[Main]
Measure=Plugin
Plugin=WebParser
Url=...
RegExp=...

[Child1]
Measure=Plugin
Plugin=WebParser
Url=[Main]
StringIndex=1

[Child2]
Measure=Plugin
Plugin=WebParser
Url=[Main]
StringIndex=2

[Child3]
Measure=Plugin
Plugin=WebParser
Url=[Main]
StringIndex=3

[cCounter]
Measure=Calc
Formula=cCounter%3+1
UpdateDivider=300

[Meter]
Meter=String
MeasureName=Child1
MeasureName2=Child2
MeasureName3=Child3
Text=%[cCounter]
DynamicVariables=1
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Change a StringIndex Value Every 5 Minutes

Post by Kaelri »

eclectic-tech wrote:Yes it is possible. You need to write the change to an included variable file, and then refresh the skin because the WebParser plugin is not dynamic.

This example assumes a variable.inc file in the @Resources folder, with a StringIndexNumber variable defined in the [Variables] section...
Just FYI, it's not necessary to write the value to a separate file, or even to use a variable. Using your example skin:

Code: Select all

IfEqualAction=[!WriteKeyValue mStation1Link StringIndex "[mCounter]"][!Refresh]
User avatar
ScoobSTi
Posts: 127
Joined: September 12th, 2012, 10:49 pm

Re: Change a StringIndex Value Every 5 Minutes

Post by ScoobSTi »

Thanks very much! Works like a charm. :)

This forum is sooo helpful, I love it! :D

Edit: I've a question, I added MeasureName4 through 6 with proper URLs and StringIndexes (I used smurfier's code), but the skin won't display them. Does Rainmeter only allow MeasureName up to MeasureName3?
Image
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Change a StringIndex Value Every 5 Minutes

Post by Kaelri »

The number of "MeasureNameN" options on a meter is unlimited. Can you show us the code you're using now?
User avatar
ScoobSTi
Posts: 127
Joined: September 12th, 2012, 10:49 pm

Re: Change a StringIndex Value Every 5 Minutes

Post by ScoobSTi »

That's weird. Also, I just found out about StringIndex2, so I'll likely have to recode some parts, especially the RegExp.

Code: Select all

[BBC Feed]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=3600
Url=http://feeds.bbci.co.uk/news/rss.xml
RegExp="(?siU)<title>(.*)</title>.*<description>(.*)</description>.*<lastBuildDate>(.*)</lastBuildDate>.*<title>(.*)</title>.*<item>.*<title>(.*)</title>.*<description>(.*)</description>.*<link>(.*)</link>.*<pubDate>(.*)</pubDate>.*<media:thumbnail width=".*" height=".*" url="(.*)"/>.*</item>.*<item>.*<title>(.*)</title>.*<description>(.*)</description>.*<link>(.*)</link>.*<pubDate>(.*)</pubDate>.*<media:thumbnail width=".*" height=".*" url="(.*)"/>.*</item>.*<item>.*<title>(.*)</title>.*<description>(.*)</description>.*<link>(.*)</link>.*<pubDate>(.*)</pubDate>.*<media:thumbnail width=".*" height=".*" url="(.*)"/>.*</item>.*<item>.*<title>(.*)</title>.*<description>(.*)</description>.*<link>(.*)</link>.*<pubDate>(.*)</pubDate>.*<media:thumbnail width=".*" height=".*" url="(.*)"/>.*</item>.*<item>.*<title>(.*)</title>.*<description>(.*)</description>.*<link>(.*)</link>.*<pubDate>(.*)</pubDate>.*<media:thumbnail width=".*" height=".*" url="(.*)"/>.*</item>.*<item>.*<title>(.*)</title>.*<description>(.*)</description>.*<link>(.*)</link>.*<pubDate>(.*)</pubDate>.*<media:thumbnail width=".*" height=".*" url="(.*)"/>.*</item>.*<item>"

[MeasureFeed1]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[BBC Feed]
StringIndex=6

[MeasureFeed2]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[BBC Feed]
StringIndex=11

[MeasureFeed3]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[BBC Feed]
StringIndex=16

[MeasureFeed4]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[BBC Feed]
StringIndex=21

[MeasureFeed5]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[BBC Feed]
StringIndex=26

[MeasureFeed6]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[BBC Feed]
StringIndex=31

[cCounter]
Measure=Calc
Formula=cCounter%3+1
UpdateDivider=300

[MeterFeed1]
MeasureName=MeasureFeed1
MeasureName2=MeasureFeed2
MeasureName3=MeasureFeed3
MeasureName4=MeasureFeed4
MeasureName5=MeasureFeed5
MeasureName6=MeasureFeed6
Meter=String
X=40R
Y=-52.5r
W=215
H=65
ClipString=1
FontColor=255,255,255,255
FontSize=10
FontFace=Roboto
Text=%[cCounter]
DynamicVariables=1
Antialias=1
LeftMouseUpAction=["http://bbc.co.uk/news"]
Actually, I've just figured it out. The [cCounter] measure needed Formula=cCounter%6+1, instead of Formula=cCounter%3+1.
Image