It is currently April 27th, 2024, 3:47 pm

Load file to display from a folder

Get help with installing and using Rainmeter.
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Load file to display from a folder

Post by balala »

Yincognito wrote: July 28th, 2023, 7:22 pm Just a small note: this will work only if there are equal numbers of 001-..., 002-... and 003-... in their respective sets (hence my question about the logic of their amount),
I assumed this. Hope it's right, otherwise as you said, things are much more complicated. I don't really want to get involved into something like this...
Yincognito wrote: July 28th, 2023, 7:22 pm Besides that, it appears that now the numerical part after the - starts from 0 and not 1 according to the OP, which, as you surely know, would probably involve some disabling and enabling of various measures (or, if things are relatively simple and don't involve dynamic change, using Loop measures instead, which would simplify things in a way).
You're perfectly right, my bad I missed this. But no, this detail doesn't complicate things too much in my opinion, but even simplifies them. The only difference is that the Formula option of the [MeasureNum2] measure should simplify. Something like this: Formula=(( MeasureNum2 + 1 ) % #MaxNum2# ) or Formula=(( MeasureNum2 + 1 ) % ( #MaxNum2#+ 1 )).

EDIT: In the last sentence above, the red-marked second formula has been posted wrongly as Formula=(( MeasureNum1 = #MaxNum1# ) ? 1 : ( MeasureNum1 + 1 )). It should have been Something like this: Formula=(( MeasureNum2 + 1 ) % ( #MaxNum2# + 1 )). The eror has been fixed, but anyone reading my post before fixing it, could have been misled.
Apologize for my mistake.

Yincognito caught my attention. Many thanks to him.
User avatar
Yincognito
Rainmeter Sage
Posts: 7177
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Load file to display from a folder

Post by Yincognito »

balala wrote: July 28th, 2023, 8:28 pmI don't really want to get involved into something like this...
I know, I'm thinking the same... :D
balala wrote: July 28th, 2023, 8:28 pmThe only difference is that the Formula option of the [MeasureNum2] measure should simplify. Something like this: Formula=(( MeasureNum2 + 1 ) % #MaxNum2# ) or Formula=(( MeasureNum1 = #MaxNum1# ) ? 1 : ( MeasureNum1 + 1 )).
Maybe I'm missing something, but don't these formulas have the same effect, i.e. starting with the output from 1? For example, MeasureNum2 is initially (i.e. before its 1st update) the default 0, so the 1st update results in the formula yielding 1, and not 0 (0 is desired as the 1st value, according to the OP's last reply)... :???:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7177
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Load file to display from a folder

Post by Yincognito »

balala wrote: July 28th, 2023, 8:28 pmHope it's right, otherwise as you said, things are much more complicated.
I believe a much better idea would be to just use a suitable combination of FileView measures to iterate through these files (filter by the txt extension, sort by file name, alter the value of the index instead). They're initially slower to read the folder's contents, of course, but you don't have to worry about the file names since, based on the OP's description, files would be sorted as desired from the start anyway. The WebParser measure would then simply read the file indicated by the output of the FileView measure(s).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Load file to display from a folder

Post by balala »

Yincognito wrote: July 28th, 2023, 8:45 pm Maybe I'm missing something,
No, you didn't miss anything. I missed it. Fixed the error in my post.

Thank you very much caught my attention. My bad!
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Load file to display from a folder

Post by balala »

Yincognito wrote: July 28th, 2023, 9:11 pm I believe a much better idea would be to just use a suitable combination of FileView measures to iterate through these files (filter by the txt extension, sort by file name, alter the value of the index instead).
Yeah, definitely this is another approach. Both have their own advantages and disadvantages. It's finally up to OP to decide which approach will he want to use. If request for help, I think he can get it for any of these approaches, we just should know which one he prefere.
User avatar
Yincognito
Rainmeter Sage
Posts: 7177
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Load file to display from a folder

Post by Yincognito »

balala wrote: July 29th, 2023, 6:25 am No, you didn't miss anything. I missed it. Fixed the error in my post.

Thank you very much caught my attention. My bad!
Sorry to insist on this, but I don't see how the formulas there would give 0 and not 1 on their first run, without initially disabling them. Anyway, I won't bother you with this anymore , just thought you should know... :confused:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Load file to display from a folder

Post by balala »

Yincognito wrote: July 29th, 2023, 10:11 am Sorry to insist on this, but I don't see how the formulas there would give 0 and not 1 on their first run, without initially disabling them. Anyway, I won't bother you with this anymore , just thought you should know... :confused:
Formula=(( MeasureNum1 = #MaxNum1# ) ? 1 : ( MeasureNum1 + 1 )) gives 1 on first run, obviously. But when I realized the second measure should start from 0, not from 1 (after your post), I said one of the following formulas should be used in the [MeasureNum2] measure: Formula=(( MeasureNum2 + 1 ) % #MaxNum2# ) or Formula=(( MeasureNum2 + 1 ) % ( #MaxNum2#+ 1 )). Both are starting from 0. Do you agree?
User avatar
Yincognito
Rainmeter Sage
Posts: 7177
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Load file to display from a folder

Post by Yincognito »

balala wrote: July 29th, 2023, 10:57 am Formula=(( MeasureNum1 = #MaxNum1# ) ? 1 : ( MeasureNum1 + 1 )) gives 1 on first run, obviously. But when I realized the second measure should start from 0, not from 1 (after your post), I said one of the following formulas should be used in the [MeasureNum2] measure: Formula=(( MeasureNum2 + 1 ) % #MaxNum2# ) or Formula=(( MeasureNum2 + 1 ) % ( #MaxNum2#+ 1 )). Both are starting from 0. Do you agree?
Well, judge for yourself:

Code: Select all

[Variables]
MaxNum2=10

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
BackgroundMode=2
SolidColor=0,0,0,128

---Measures---

[MeasureNum2_Variant1]
Measure=Calc
Formula=(( MeasureNum2_Variant1 + 1 ) % #MaxNum2# )
UpdateDivider=2

[MeasureNum2_Variant2]
Measure=Calc
Formula=(( MeasureNum2_Variant2 + 1 ) % ( #MaxNum2#+ 1 ))
UpdateDivider=2

---Meters---

[Result]
Meter=String
FontFace=Consolas
FontSize=16
FontColor=255,255,255,255
AntiAlias=1
MeasureName=MeasureNum2_Variant1
MeasureName2=MeasureNum2_Variant2
Text=Result (Variant 1) = %1#CRLF#Result (Variant 2) = %2
I left both versions of your formulas in two measures and set an update divider of 2, for easy comparison. Both variants start from 1.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Load file to display from a folder

Post by balala »

Yincognito wrote: July 29th, 2023, 11:27 am I left both versions of your formulas in two measures and set an update divider of 2, for easy comparison. Both variants start from 1.
On first run. When once #MaxNum2# is reached, the measures are restarted by 0. Since the process is repeating itself, I assumed this is alright. Didn't necessary deal with what is going on on first run.
User avatar
Yincognito
Rainmeter Sage
Posts: 7177
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Load file to display from a folder

Post by Yincognito »

balala wrote: July 29th, 2023, 12:01 pm On first run. When once #MaxNum2# is reached, the measures are restarted by 0. Since the process is repeating itself, I assumed this is alright. Didn't necessary deal with what is going on on first run.
Indeed. Not a big issue as it only happens once, what I meant was that it does happen. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth