It is currently July 27th, 2024, 12:22 am

Loops

Report bugs with the Rainmeter application and suggest features.
Epp
Posts: 1
Joined: April 19th, 2009, 2:19 am
Location: Chch, New Zealand

Loops

Post by Epp »

It would be nice to have some kind of loop functionality for dealing with sets of data for example using a web parser + regex

[Example]
Meter=STRING
Measure=Parser ; some parser that returns a bunch of data

Format=NewLine ; Some sort of format to display that data, new line, same line etc
while(%1) [DisplayText="Data: %1"]
;DisplayText prints the string, maybe a displayImage type thing to show an image pointed to by %1 as well, allowing bangs to be added to each set of Display items would be nice as well eg something like [DisplayText="" LeftMouseDownAction=]

hope you understand what I mean
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: Loops

Post by dragonmage »

Could you give an example of what could be displayed by this? I'm not sure that I understand.
User avatar
limpet
Posts: 34
Joined: April 21st, 2009, 5:25 pm
Location: NC, USA

Re: Loops

Post by limpet »

I have wanted something similar to this and would have been very useful.

The most basic example, I believe would be simple count and output kind of situations, such as dates. But what I think Epp wants is something that can iterate through a set of data and display something.

For example, looping through RSS feeds and outputting multiple lines as it loops through each string offset (as webpaser seems to currently work).
Limpet makes music: [Soundcloud][Reverbnation][Myspace (ick)][Uvumi][Electronic/Dance]
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: Loops

Post by dragonmage »

I think that would be possible in a roundabout way. You could set up the measures and meters to retrieve and display sets of data and use CALC measures to switch them at certain times.
User avatar
limpet
Posts: 34
Joined: April 21st, 2009, 5:25 pm
Location: NC, USA

Re: Loops

Post by limpet »

I may not be fully understanding what you're saying, but it seems that you would be creating a measure/meter for each line of data you want to retrieve?

I think the original goal was to keep all the data that is displayed in one string meter. Which makes me wonder if it's possible to display multiple lines in one meter. I don't remember.
Limpet makes music: [Soundcloud][Reverbnation][Myspace (ick)][Uvumi][Electronic/Dance]
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: Loops

Post by dragonmage »

I'm not that familiar with how the webparser works, but however it works now, you could disable/enable the measures and meters to switch between them.
kati42
Posts: 35
Joined: May 4th, 2009, 4:25 am

Re: Loops

Post by kati42 »

That would presume a "fixed length loop". In other words, where you code it in advance to show 4 items. Real loops would let you "display all RSS items fetched" or whatever instead of "display the first 10". Not sure how often that comes up, though.

Another use for looping (even fixed length) is to help with lists, or multi-day weather layouts. Sure, you could have a separate set of meters for each day. But then if you're changing the way they're displayed you have to modify each and every one. If there was a looping mechanism, you could just give the layout of a day or an item and essentially say "do it like this for all items, but move the info over by 40 pixels for each one".

Seems less critical to me than some of the other requests, but others may disagree.
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Loops

Post by smurfier »

I would really like to see loops, or conditional loops. More so in the calc measure. In the math world this is known as iterate. Repeat a set up steps until a condition is met. I'm working on doing something but since Rainmeter's built in calc measure isn't capable of the calculations I need, I'm working on learning how to make a plugin.
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
jsmorley
Developer
Posts: 22649
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Loops

Post by jsmorley »

The problem is that Rainmeter is not a programming language as such. There really isn't any "flow control" other than "read the .ini, do each measure and display each meter in the order they are in the .ini, spit, rinse, repeat". To have what is the most basic flow controls like "do while / for next / if then else / goto" in a way that is more robust than the currently limited functionality of Calc measures and DynamicVariables would in my opinion require a major change to the code and the method of operation of Rainmeter. Don't forget, Rainmeter isn't a "scripting language", it is a "program", controlled by a .ini file that is really just a bunch of parameters for a couple of routines (DoMeasure / DisplayMeter) that just run over and over in a loop.

Not sure how we would even approach this without fundamentally changing Rainmeter from a "program" into a "scripting language". I'm sure there is a way with a LUA or Python library integrated somehow, but to fully integrate with Rainmeter might be quite a challenge.