It is currently April 27th, 2024, 11:36 pm

Help me : Want to display data only match with system date

Get help with creating, editing & fixing problems with skins
OpenUser
Posts: 6
Joined: May 28th, 2021, 9:53 am

Help me : Want to display data only match with system date

Post by OpenUser »

Hi everyone,
I am looking for help in this forum, I have some data in excel file, I want to display this data in my desktop using Rainmeter.

What I Want?
Want to display data only match with system date, for example if I open my computer to 04 January 2024, it will display the all data related to only 04 January 2024.

Note:
1. Single date can have multiple occurrences of data or can have single line of data. So it will must display all the data from related date.
2. I am attaching images for demo what data I have and how I want to display it.
I am novice to programming, so help me to do this, any help is very appreciated.

Thanks in advance.

Image
Image
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help me : Want to display data only match with system date

Post by Yincognito »

OpenUser wrote: March 4th, 2024, 1:04 pm Hi everyone,
I am looking for help in this forum, I have some data in excel file, I want to display this data in my desktop using Rainmeter.

What I Want?
Want to display data only match with system date, for example if I open my computer to 04 January 2024, it will display the all data related to only 04 January 2024.

Note:
1. Single date can have multiple occurrences of data or can have single line of data. So it will must display all the data from related date.
2. I am attaching images for demo what data I have and how I want to display it.
I am novice to programming, so help me to do this, any help is very appreciated.

Thanks in advance.

Image
Image
First of all, just so you know, we don't do skin requests - we can gladly help with advice and bits of code where needed, but we will not do the work for you. It's your skin, your interest, and we can only teach you how to do it yourself (if you want to learn and put a little effort into it, that is).

Secondly, what you want, while simple in terms of principles, it's not that simple in terms of implementing it. It can be done, but as a novice in programming, it might be a bit too much for you to take at once. In your particular case, since Rainmeter cannot "read" Excel files, you would have to:
- export / save your data (preferably, only the result of an Excel query for stuff matching the current date, as per your description) to a .csv / .txt file, from an Excel macro
- since the resulting file would now be basically a text file that Rainmeter can parse, use a WebParser measure with its URL option set to that local file to retrieve it
- further manipulate the text retrieved from the file by using a (RegExp) Substitute added to the desired measures, according to your needs

An example of what would generally take to do what you want (except the date filtering, which would be simpler to do directly in Excel before exporting) in this thread:
https://forum.rainmeter.net/viewtopic.php?t=35943&start=10#p182380
The above includes some things you probably don't need, like a few tricks to display the result in "columns", but it should be enough to give you an idea of how such an objective can be approached.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
OpenUser
Posts: 6
Joined: May 28th, 2021, 9:53 am

Re: Help me : Want to display data only match with system date

Post by OpenUser »

Hi,
Thanks for quick help and suggestions. After reading suggested content and reading some rainmeter manuals, I wrote a code.

But now facing an issue that rainmeter-skin is showing data from only 1st row of text file. For proper working of rainmeter-skin, coding needs to check each line in text file and compare the system date with each line of text file. But I don’t know how to do that!

What I Want?
Want to display data only match with system date, for example if I open my computer to 04 January 2024, it will display the all data related to only 04 January 2024, whether it is a single line or multiple entries.

Note:
1. Please see my text file content, I can change the data format for easiness and smooth working.
2. Any suggestion is welcome.

Yes! I am novice to programming, but willing to learn. any help is very appreciated.

Thanks in advance.

code.ini

Code: Select all

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

[MeasureText]
Measure=WebParser
URL=file://#CURRENTPATH#Book1.txt
RegExp=(?siU)<01>(.*)</01>.* <02>(.*)</02>.* <03>(.*)</03>.* <04>(.*)</04>.* <05>(.*)</05>.* <06>(.*)</06>.* <07>(.*)</07>
UpdateRate=3600

[Measure1]
Measure=Plugin
Plugin=WebParser
URL=[MeasureText]
StringIndex=1
Substitute="24":"2024", "1":"01" , "Jan":"January", "-":" "
DynamicVariables=1

[Measure2]
Measure=Plugin
Plugin=WebParser
URL=[MeasureText]
StringIndex=2

[Measure3]
Measure=Plugin
Plugin=WebParser
URL=file://#CURRENTPATH#[MeasureText]
StringIndex=3
Download=1

[Measure4]
Measure=Plugin
Plugin=WebParser
URL=[MeasureText]
StringIndex=4

[Measure5]
Measure=Plugin
Plugin=WebParser
URL=[MeasureText]
StringIndex=5

[Measure6]
Measure=Plugin
Plugin=WebParser
URL=[MeasureText]
StringIndex=6

[Measure7]
Measure=Plugin
Plugin=WebParser
URL=[MeasureText]
StringIndex=7

[MeterBackground]
Meter=Image
ImageName=Background.png
W=420
H=170

[MeterOne]
Meter=String
MeasureName=Measure1
MeterStyle=StringStyle
FontColor=255,255,255,255
FontFace=Segoe UI
FontSize=17
StringEffect=Shadow
FontEffectColor=0,0,0,255
AntiAlias=1
X=20
Y=10

[MeterTwo]
Meter=String
MeasureName=Measure2
MeterStyle=StringStyle
FontColor=255,255,255,255
FontFace=Segoe UI
FontSize=17
StringEffect=Shadow
FontEffectColor=0,0,0,255
AntiAlias=1
X=115
Y=50

[MeterThree]
Meter=Image
URL=#CURRENTPATH#[MeasureText]
MeasureName=Measure3
MeterStyle=StringStyle
FontFace=Segoe UI Variable
FontColor=220,220,220
;StringStyle=Bold
FontSize=20
AntiAlias=1
X=20
Y=50
W=85
H=80

[MeterFour]
Meter=String
MeasureName=Measure4
MeterStyle=StringStyle
FontFace=Segoe UI Variable
FontColor=220,220,220
;StringStyle=Bold
FontSize=16
AntiAlias=1
X=130
Y=80

[MeterFive]
Meter=String
MeasureName=Measure5
MeterStyle=StringStyle
FontFace=Segoe UI Variable
FontColor=220,220,220
;StringStyle=Bold
FontSize=12
AntiAlias=1
X=110
Y=110

[MeterSix]
Meter=String
MeasureName=Measure6
MeterStyle=StringStyle
FontFace=Segoe UI Variable
FontColor=220,220,220
;StringStyle=Bold
FontSize=12
AntiAlias=1
X=270
Y=110

[MeterSeven]
Meter=String
MeasureName=Measure7
MeterStyle=StringStyle
FontFace=Segoe UI Variable
FontColor=220,220,220
;StringStyle=Bold
FontSize=14
AntiAlias=1
X=20
Y=135
Book1.txt

Code: Select all

<01>1-Jan-24</01> <02>Adam</02> <03>Adam.jpg</03> <04>New York</04> <05>START TIME: 4.30 PM</05> <06>END TIME: 6.30 PM</06> <07>YOUR NEXT VISIT TIME IS: 1/4/2024 10.30 PM</07>
<01>2-Jan-24</01> <02>Clain</02> <03>Clain.jpg</03> <04>California</04> <05>START TIME: 12.50 PM</05> <06>END TIME: 3.30 PM</06> <07>YOUR NEXT VISIT TIME IS: 1/15/2024 5.55 PM</07>
<01>3-Jan-24</01> <02>Rose</02> <03>Rose.jpg</03> <04>Florida</04> <05>START TIME: 3.30 PM</05> <06>END TIME: 5.09 PM</06> <07>YOUR NEXT VISIT TIME IS: 1/10/2024 8.18 PM</07>
<01>4-Jan-24</01> <02>Donald</02> <03>Donald.jpg</03> <04>Georgia</04> <05>START TIME: 5.09 PM</05> <06>END TIME: 7.15 PM</06> <07>YOUR NEXT VISIT TIME IS: 1/09/2024 10.30 PM</07>
<01>4-Jan-24</01> <02>Donald</02> <03>Donald.jpg</03> <04>Georgia</04> <05>START TIME: 2.10 PM</05> <06>END TIME: 4.13 PM</06> <07>YOUR NEXT VISIT TIME IS: 1/25/2024 6.15 PM</07>
<01>6-Jan-24</01> <02>William</02> <03>William.jpg</03> <04>Kansas</04> <05>START TIME: 11.25 PM</05> <06>END TIME: 1.25 PM</06> <07>YOUR NEXT VISIT TIME IS: 1/18/2024 09.30 PM</07>
RicardoTM
Posts: 268
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Help me : Want to display data only match with system date

Post by RicardoTM »

I have no time right now but check time measure and ifmatch
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help me : Want to display data only match with system date

Post by Yincognito »

OpenUser wrote: March 5th, 2024, 2:19 pm Hi,
Thanks for quick help and suggestions. After reading suggested content and reading some rainmeter manuals, I wrote a code.

But now facing an issue that rainmeter-skin is showing data from only 1st row of text file. For proper working of rainmeter-skin, coding needs to check each line in text file and compare the system date with each line of text file. But I don’t know how to do that!

What I Want?
Want to display data only match with system date, for example if I open my computer to 04 January 2024, it will display the all data related to only 04 January 2024, whether it is a single line or multiple entries.

Note:
1. Please see my text file content, I can change the data format for easiness and smooth working.
2. Any suggestion is welcome.

Yes! I am novice to programming, but willing to learn. any help is very appreciated.

Thanks in advance.
Well done! Bar a few minor mistakes, the code is alright. :thumbup:

Keeping the stuff that only match the system date is relatively simple, like RicardoTM already mentioned. First, you'd need a Time measure in your code that will get the current time, formatted to suit the system used in your Book1.txt (I assume, the <01>...</01> field):

Code: Select all

[Variables]
Item=(?(?=.*\R.*).*(<01>[mTime]<\/01>.*)\R.*)
ItemIndex=1
ItemCount=1

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

---Measures---

[mTime]
Measure=Time
Format=%#d-%b-%y

[mBook]
Measure=WebParser
URL=file://#CURRENTPATH#Book1.txt
RegExp=(?siU)#Item##Item##Item##Item##Item##Item##Item##Item##Item##Item#
LogSubstringErrors=0
UpdateRate=3600
FinishAction=[!UpdateMeasureGroup Fields][!UpdateMeter *][!Redraw]

-1-

[mItem1Field1]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=1
RegExp=(?siU)<01>(.*)<\/01>
StringIndex2=1
UpdateDivider=-1
IfMatch=^$
IfNotMatchAction=[!SetVariable ItemCount 1]
IfMatchMode=1

[mItem1Field2]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=1
RegExp=(?siU)<02>(.*)<\/02>
StringIndex2=1
UpdateDivider=-1

[mItem1Field3]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=1
RegExp=(?siU)<03>(.*)<\/03>
StringIndex2=1
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^$":"None.jpg"

[mItem1Field4]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=1
RegExp=(?siU)<04>(.*)<\/04>
StringIndex2=1
UpdateDivider=-1

[mItem1Field5]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=1
RegExp=(?siU)<05>(.*)<\/05>
StringIndex2=1
UpdateDivider=-1

[mItem1Field6]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=1
RegExp=(?siU)<06>(.*)<\/06>
StringIndex2=1
UpdateDivider=-1

[mItem1Field7]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=1
RegExp=(?siU)<07>(.*)<\/07>
StringIndex2=1
UpdateDivider=-1

-2-

[mItem2Field1]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=2
RegExp=(?siU)<01>(.*)<\/01>
StringIndex2=1
UpdateDivider=-1
IfMatch=^$
IfNotMatchAction=[!SetVariable ItemCount 2]
IfMatchMode=1

[mItem2Field2]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=2
RegExp=(?siU)<02>(.*)<\/02>
StringIndex2=1
UpdateDivider=-1

[mItem2Field3]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=2
RegExp=(?siU)<03>(.*)<\/03>
StringIndex2=1
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^$":"None.jpg"

[mItem2Field4]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=2
RegExp=(?siU)<04>(.*)<\/04>
StringIndex2=1
UpdateDivider=-1

[mItem2Field5]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=2
RegExp=(?siU)<05>(.*)<\/05>
StringIndex2=1
UpdateDivider=-1

[mItem2Field6]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=2
RegExp=(?siU)<06>(.*)<\/06>
StringIndex2=1
UpdateDivider=-1

[mItem2Field7]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=2
RegExp=(?siU)<07>(.*)<\/07>
StringIndex2=1
UpdateDivider=-1

-3-

[mItem3Field1]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=3
RegExp=(?siU)<01>(.*)<\/01>
StringIndex2=1
UpdateDivider=-1
IfMatch=^$
IfNotMatchAction=[!SetVariable ItemCount 3]
IfMatchMode=1

[mItem3Field2]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=3
RegExp=(?siU)<02>(.*)<\/02>
StringIndex2=1
UpdateDivider=-1

[mItem3Field3]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=3
RegExp=(?siU)<03>(.*)<\/03>
StringIndex2=1
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^$":"None.jpg"

[mItem3Field4]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=3
RegExp=(?siU)<04>(.*)<\/04>
StringIndex2=1
UpdateDivider=-1

[mItem3Field5]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=3
RegExp=(?siU)<05>(.*)<\/05>
StringIndex2=1
UpdateDivider=-1

[mItem3Field6]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=3
RegExp=(?siU)<06>(.*)<\/06>
StringIndex2=1
UpdateDivider=-1

[mItem3Field7]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=3
RegExp=(?siU)<07>(.*)<\/07>
StringIndex2=1
UpdateDivider=-1

---Styles---

[StringStyle]
FontColor=255,255,255,255
FontFace=Segoe UI
FontSize=16
StringEffect=Shadow
FontEffectColor=0,0,0,255
AntiAlias=1
DynamicVariables=1

---Meters---

[Background]
Meter=Image
MeterStyle=StringStyle
ImageName=Background.png
W=420
H=170
MouseScrollUpAction=[!SetVariable ItemIndex (Clamp(#ItemIndex#-1,1,#ItemCount#))][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetVariable ItemIndex (Clamp(#ItemIndex#+1,1,#ItemCount#))][!UpdateMeter *][!Redraw]

[ItemField1]
Meter=String
MeterStyle=StringStyle
X=20
Y=10
MeasureName=mItem#ItemIndex#Field1

[ItemField2]
Meter=String
MeterStyle=StringStyle
X=115
Y=50
MeasureName=mItem#ItemIndex#Field2

[ItemField3]
Meter=Image
MeterStyle=StringStyle
X=20
Y=50
W=85
H=80
MeasureName=mItem#ItemIndex#Field3
ImageName=#CURRENTPATH#%1

[ItemField4]
Meter=String
MeterStyle=StringStyle
X=130
Y=80
FontSize=16
MeasureName=mItem#ItemIndex#Field4

[ItemField5]
Meter=String
MeterStyle=StringStyle
X=110
Y=110
FontSize=12
MeasureName=mItem#ItemIndex#Field5

[ItemField6]
Meter=String
MeterStyle=StringStyle
X=270
Y=110
FontSize=12
MeasureName=mItem#ItemIndex#Field6

[ItemField7]
Meter=String
MeterStyle=StringStyle
X=20
Y=135
FontSize=14
MeasureName=mItem#ItemIndex#Field7

Then, in order for this to work smoothly, you'd need to add a newline at the end of Book1.txt when exporting it, so that it looks like this:

Code: Select all

<01>1-Jan-24</01> <02>Adam</02> <03>Adam.jpg</03> <04>New York</04> <05>START TIME: 4.30 PM</05> <06>END TIME: 6.30 PM</06> <07>YOUR NEXT VISIT TIME IS: 1/4/2024 10.30 PM</07>
<01>2-Jan-24</01> <02>Clain</02> <03>Clain.jpg</03> <04>California</04> <05>START TIME: 12.50 PM</05> <06>END TIME: 3.30 PM</06> <07>YOUR NEXT VISIT TIME IS: 1/15/2024 5.55 PM</07>
<01>3-Jan-24</01> <02>Rose</02> <03>Rose.jpg</03> <04>Florida</04> <05>START TIME: 3.30 PM</05> <06>END TIME: 5.09 PM</06> <07>YOUR NEXT VISIT TIME IS: 1/10/2024 8.18 PM</07>
<01>4-Jan-24</01> <02>Donald</02> <03>Donald.jpg</03> <04>Georgia</04> <05>START TIME: 5.09 PM</05> <06>END TIME: 7.15 PM</06> <07>YOUR NEXT VISIT TIME IS: 1/09/2024 10.30 PM</07>
<01>4-Jan-24</01> <02>Donald</02> <03>Donald.jpg</03> <04>Georgia</04> <05>START TIME: 2.10 PM</05> <06>END TIME: 4.13 PM</06> <07>YOUR NEXT VISIT TIME IS: 1/25/2024 6.15 PM</07>
<01>6-Jan-24</01> <02>William</02> <03>William.jpg</03> <04>Kansas</04> <05>START TIME: 11.25 PM</05> <06>END TIME: 1.25 PM</06> <07>YOUR NEXT VISIT TIME IS: 1/18/2024 09.30 PM</07>

Once you do, the lookahead assertion in the Item variable above will capture (using the round brackets) the contents of every line that has a <01>...</01> field matching the aforementioned Time measure, which I called mTime. In case you wonder, . means any character, * means any number of times, \R means a newline, and / needs to be escaped by preceding it with a \ since it's a reserved character in regex.

In the RegExp option of the parent WebParser measure, I added a sufficient number of #Item# patterns. Then, in the WebParser child measures, I used both StringIndex and StringIndex2 to get the StringIndex2-th field (corresponding to each child measure's RegExp) from the StringIndex-th item. The patterns are kept simple and easy to change if desired.

In the meters (see how to properly use MeterStyles, by the way), I only display the fields of one matching item at a time, and if there are more the user can scroll to navigate them. I did this by using an ItemIndex variable in the MeasureName options, the value of which gets incremented or decremented based on the direction of mouse scrolling from the Background meter. To make things more natural, I limited the scrolling between 1 and #ItemCount#, which is set by an IfMatch in the measures corresponding to the 1st field of each item (that simply checks if the 1st field is the empty string and if not, it sets ItemCount accordingly). To be sure that this works properly, I updated the child measure Group from the FinishAction of the parent, and set IfMatchMode to 1, so that the tests and the actions are performed each time those measures update.

I let the meter positions unchanged. You can add a sufficient number of #Item#-s in the parent measure's RegExp, and a sufficient number of item field measures as desired. Things could have been done in a more compact fashion by getting the entire file contents in the parent WebParser measure, removing the parts that did not match the mTime, then extracting only the #ItemIndex#-th item's fields in String measures, but I let it like this in case you want to display fields from multiple items in the skin. I know, there's going to be a ton of measures there, but that's how things work in this case, and in the end it's just a matter of copy paste and changing the relevant numbers in each measure (this is why I said I preferred aggregating stuff when possible in the other thread).

P.S. Sorry for the delay in responding, been busy with other stuff as well today.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
OpenUser
Posts: 6
Joined: May 28th, 2021, 9:53 am

Re: Help me : Want to display data only match with system date

Post by OpenUser »

hi,
Sorry for late reply.
Yincognito thanks for your help, your code is working well. But when i increase the number of lines in text file it stopped working, sometimes it shows regex matching error -08 in log and sometime no error but display nothing in meter. Is rainmeter have any restriction related to text lines or text file size?

Thanks

Code: Select all

[Variables]
Item=(?(?=.*\R.*).*(<01>[mTime]<\/01>.*)\R.*)
ItemIndex=1
ItemCount=1

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

---Measures---

[mTime]
Measure=Time
Format=%#d-%b-%y

[mBook]
Measure=WebParser
URL=file://#CURRENTPATH#Book1.txt
RegExp=(?siU)#Item##Item##Item##Item##Item##Item##Item##Item##Item##Item#
LogSubstringErrors=0
UpdateRate=3600
FinishAction=[!UpdateMeasureGroup Fields][!UpdateMeter *][!Redraw]

-1-

[mItem1Field1]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=1
RegExp=(?siU)<01>(.*)<\/01>
StringIndex2=1
UpdateDivider=-1
IfMatch=^$
IfNotMatchAction=[!SetVariable ItemCount 1]
IfMatchMode=1

[mItem1Field2]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=1
RegExp=(?siU)<02>(.*)<\/02>
StringIndex2=1
UpdateDivider=-1

[mItem1Field3]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=1
RegExp=(?siU)<03>(.*)<\/03>
StringIndex2=1
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^$":"None.jpg"

[mItem1Field4]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=1
RegExp=(?siU)<04>(.*)<\/04>
StringIndex2=1
UpdateDivider=-1

[mItem1Field5]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=1
RegExp=(?siU)<05>(.*)<\/05>
StringIndex2=1
UpdateDivider=-1

[mItem1Field6]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=1
RegExp=(?siU)<06>(.*)<\/06>
StringIndex2=1
UpdateDivider=-1

[mItem1Field7]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=1
RegExp=(?siU)<07>(.*)<\/07>
StringIndex2=1
UpdateDivider=-1

-2-

[mItem2Field1]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=2
RegExp=(?siU)<01>(.*)<\/01>
StringIndex2=1
UpdateDivider=-1
IfMatch=^$
IfNotMatchAction=[!SetVariable ItemCount 2]
IfMatchMode=1

[mItem2Field2]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=2
RegExp=(?siU)<02>(.*)<\/02>
StringIndex2=1
UpdateDivider=-1

[mItem2Field3]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=2
RegExp=(?siU)<03>(.*)<\/03>
StringIndex2=1
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^$":"None.jpg"

[mItem2Field4]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=2
RegExp=(?siU)<04>(.*)<\/04>
StringIndex2=1
UpdateDivider=-1

[mItem2Field5]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=2
RegExp=(?siU)<05>(.*)<\/05>
StringIndex2=1
UpdateDivider=-1

[mItem2Field6]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=2
RegExp=(?siU)<06>(.*)<\/06>
StringIndex2=1
UpdateDivider=-1

[mItem2Field7]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=2
RegExp=(?siU)<07>(.*)<\/07>
StringIndex2=1
UpdateDivider=-1

-3-

[mItem3Field1]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=3
RegExp=(?siU)<01>(.*)<\/01>
StringIndex2=1
UpdateDivider=-1
IfMatch=^$
IfNotMatchAction=[!SetVariable ItemCount 3]
IfMatchMode=1

[mItem3Field2]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=3
RegExp=(?siU)<02>(.*)<\/02>
StringIndex2=1
UpdateDivider=-1

[mItem3Field3]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=3
RegExp=(?siU)<03>(.*)<\/03>
StringIndex2=1
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^$":"None.jpg"

[mItem3Field4]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=3
RegExp=(?siU)<04>(.*)<\/04>
StringIndex2=1
UpdateDivider=-1

[mItem3Field5]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=3
RegExp=(?siU)<05>(.*)<\/05>
StringIndex2=1
UpdateDivider=-1

[mItem3Field6]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=3
RegExp=(?siU)<06>(.*)<\/06>
StringIndex2=1
UpdateDivider=-1

[mItem3Field7]
Group=Fields
Measure=WebParser
URL=[mBook]
StringIndex=3
RegExp=(?siU)<07>(.*)<\/07>
StringIndex2=1
UpdateDivider=-1

---Styles---

[StringStyle]
FontColor=255,255,255,255
FontFace=Segoe UI
FontSize=16
StringEffect=Shadow
FontEffectColor=0,0,0,255
AntiAlias=1
DynamicVariables=1

---Meters---

[Background]
Meter=Image
MeterStyle=StringStyle
ImageName=Background.png
W=420
H=170
MouseScrollUpAction=[!SetVariable ItemIndex (Clamp(#ItemIndex#-1,1,#ItemCount#))][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetVariable ItemIndex (Clamp(#ItemIndex#+1,1,#ItemCount#))][!UpdateMeter *][!Redraw]

[ItemField1]
Meter=String
MeterStyle=StringStyle
X=20
Y=10
MeasureName=mItem#ItemIndex#Field1

[ItemField2]
Meter=String
MeterStyle=StringStyle
X=115
Y=50
MeasureName=mItem#ItemIndex#Field2

[ItemField3]
Meter=Image
MeterStyle=StringStyle
X=20
Y=50
W=85
H=80
MeasureName=mItem#ItemIndex#Field3
ImageName=#CURRENTPATH#%1

[ItemField4]
Meter=String
MeterStyle=StringStyle
X=130
Y=80
FontSize=16
MeasureName=mItem#ItemIndex#Field4

[ItemField5]
Meter=String
MeterStyle=StringStyle
X=110
Y=110
FontSize=12
MeasureName=mItem#ItemIndex#Field5

[ItemField6]
Meter=String
MeterStyle=StringStyle
X=270
Y=110
FontSize=12
MeasureName=mItem#ItemIndex#Field6

[ItemField7]
Meter=String
MeterStyle=StringStyle
X=20
Y=135
FontSize=14
MeasureName=mItem#ItemIndex#Field7

You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help me : Want to display data only match with system date

Post by Yincognito »

OpenUser wrote: March 19th, 2024, 7:26 am hi,
Sorry for late reply.
Yincognito thanks for your help, your code is working well. But when i increase the number of lines in text file it stopped working, sometimes it shows regex matching error -08 in log and sometime no error but display nothing in meter. Is rainmeter have any restriction related to text lines or text file size?

Thanks
Well, regex does have certain limits, just like everything else, but I don't think the file string is that big to have such issues here. I'm not on my laptop yet so I can't test for now, but when I'll be, I'll test this to see what's going on. On a first look, everything seems fine, but obviously in this case you should only get one match, aka the current day's field values from the file. I'll keep you posted on this.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help me : Want to display data only match with system date

Post by Yincognito »

OpenUser wrote: March 19th, 2024, 7:26 amBut when i increase the number of lines in text file it stopped working, sometimes it shows regex matching error -08 in log and sometime no error but display nothing in meter. Is rainmeter have any restriction related to text lines or text file size?
Alright, tested the code and indeed it throws that error. Apparently, the lookahead assertions in the Item variable have to test too many possible occurrences in your file, something one can see if testing the file contents and the regex on testing grounds like the RegExR.com or regex101.com sites, where similar errors occur. So yeah, it looks like such a limitation has been reached in your case.

The solution is simple in terms of changes, but it involves a less known regex group named the branch reset group. So, avoiding using the lookahead assertion and using the branch reset group (without actually capturing anything in the 2nd brach, in order to "skip" past unmatched instances) in the Item variable from [Variables] should solve the issue:

Code: Select all

Item=(?|.*(<01>[mTime]<\/01>.*)\R|.*)
To be on the safe side and be able to test it on online sites as well, you could also add a ^ before the #Item# list in the RegExp option from your mBook measure. Things seem to work in Rainmeter without this detail, but on the online regex sites you'll get errors like "catastrophic backtracking" if you don't "anchor" the pattern to the beginning of the string (represented by the aforementioned ^ symbol).

Reference: https://www.regular-expressions.info/branchreset.html
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
nek
Posts: 105
Joined: November 3rd, 2019, 12:00 am

Re: Help me : Want to display data only match with system date

Post by nek »

An example of pagination.
preview.png
Usage:
- Scroll the mouse wheel to switch pages on the skin.
- Right-click on the skin to show context menu.
💡 Menu > Skin scaling > 100%-500%
pagination.png


Pagination.Example.zip
The default location of the Skins: C:\Users\%UserName%\Documents\Rainmeter\Skins


How the skin works:

* book1.txt (modified)

Code: Select all

<01>2024-01-01</01>	<02>Adam</02> <03>Adam.jpg</03> <04>New York</04> <05>4.30 PM</05> <06>6.30 PM</06> <07>1/4/2024 10.30 PM</07>
<01>2024-01-02</01>	<02>Clain</02> <03>Clain.jpg</03> <04>California</04> <05>12.50 PM</05> <06>3.30 PM</06> <07>1/15/2024 5.55 PM</07>
...
<01>2024-12-31</01>	<02>William</02> <03>William.jpg</03> <04>Kansas</04> <05>11.25 PM</05> <06>1.25 PM</06> <07>1/18/2024 09.30 PM</07>
* Lua table

Code: Select all

_items = {
	{ '2024-01-01', 'Adam', 'Adam.jpg', 'New York', '4.30 PM', '6.30 PM', '1/4/2024 10.30 PM' },
	{ '2024-01-02', 'Clain', 'Clain.jpg', 'California', '12.50 PM', '3.30 PM', '1/15/2024 5.55 PM' },
	...
	{ '2024-12-31', 'William', 'William.jpg', 'Kansas', '11.25 PM', '1.25 PM', '1/18/2024 09.30 PM' }
}
Read the text file (exported by Excel book) using Lua and generate a Lua table. 📗 Lua Scripting (Rainmeter Docs)

A part of @Resources\Scripts\init.lua

Code: Select all

local number_of_elements = 7

-----------------------------------------------------------------------------
-- Read the text file (output by Excel book) and generate an items table
-- **UTF-8 encoded file or ANSI ONLY**
--
-- @see  Input and Output| https://www.lua.org/manual/5.1/manual.html#5.7
-- @see  Tables Tutorial | http://lua-users.org/wiki/TablesTutorial
-----------------------------------------------------------------------------
local function read_book_data(file_path)

    _items = {}
    local fh = io.open(file_path, 'r')
    if fh then
        local t
        for line in fh:lines() do
            if line:find('^%s*<01>') then
                t = {}
                for i=1, number_of_elements do
                    table.insert(t, line:match(string.format('<%02d>(.-)</%02d>', i, i)) or '')
                end
                table.insert(_items, t)
            end
        end
        fh:close()
    end

end


-----------------------------------------------------------------------------
-- Increase or Decrease item_index number by mouse wheel scrolling then call load_item()
--
-- @param  {number}  d      scrolling direction. `-1` scroll up, `1` scroll down.
-- @example                 MouseScrollDownAction=[!CommandMeasure MeasureScript "background_scroll(1)"]
--                          MouseScrollUpAction=[!CommandMeasure MeasureScript "background_scroll(-1)"]
--
-- @see    Creating a "counter" or "loop" by jsmorley | https://forum.rainmeter.net/viewtopic.php?p=96827#p96827
-----------------------------------------------------------------------------
function background_scroll(d)

    if 0<#items then
        load_item((item_index + d - 1) % #items + 1)
    end

end
You do not have the required permissions to view the files attached to this post.
Last edited by nek on March 24th, 2024, 5:37 am, edited 2 times in total.
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help me : Want to display data only match with system date

Post by Yincognito »

nek wrote: March 22nd, 2024, 7:14 pm An example of pagination.
Very nice - an excellent alternative! :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth