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

Highlighting certain Text based on current Date

Help with creating, editing & fixing problems with skins
SomaKhaos
Posts: 4
Joined: June 4th, 2019, 3:03 pm

Highlighting certain Text based on current Date

SomaKhaos » June 4th, 2019, 3:13 pm

Hey there,


i just found the Sticky Notes Skin from KrupeshAnadkat (https://www.deviantart.com/krupeshanadkat/art/Sticky-Notes-rainmeter-717733858).
And i use it to display my work schedule on desktop.

Now my question, is it possible to highlight certain lines on it based on the current date?

Here's the code of it, i just tweaked the sizes a little so it fits with my work schedule

Code: Select all

[Rainmeter]
Author=Krupesh M Anadkat
Update=1000

[Variables]
Note=C:\Sticky Notes\notes1.txt
ScreenHeight=650
ScreenHeight2=650
BoxTransparent=340
FontName=Segoe UI
FontColor=0, 0, 0, 150
FontHeight=10
AntiAlias=1
;---------------------------

[MeasureNote]
Measure=Plugin
Plugin=Plugins\QuotePlugin.dll
PathName=#Note#
Disabled=0
Separator=¶
#Subfolders=0
#FileFilter=*.txt
;--------------------------

[Top]
Meter=IMAGE
SolidColor=0, 0, 0, #BoxTransparent#
X=0
Y=0
W=310
H=50
AntiAlias=1
;--------------------------
[Title]
Meter=STRING
X=66
Y=10
FontColor=255,255,255,255
FontSize=14
FontFace=SF Old Republic
StringAlign=Left
Prefix="Arbeitsplan"
AntiAlias=1
MouseOverAction=!Execute [!RainmeterShowMeter NotesTitleHighlight][!RainmeterRedraw]
MouseLeaveAction=!Execute [!RainmeterHideMeter NotesTitleHighlight][!RainmeterRedraw]
LeftMouseDownAction=!Execute ["#Note#"][!RainmeterRedraw]
;--------------------------

[Box]
Meter=IMAGE
SolidColor=0, 0, 0, 280
X=0
Y=35r
W=310
H=#ScreenHeight#
AntiAlias=1
Hidden=0
;--------------------------
[Note]
Meter=STRING
MeasureName=MeasureNote
X=8
Y=55
W=310
H=#ScreenHeight#
FontColor=255,255,255,255
FontFace=#FontName#
FontSize=12
StringAlign=LEFT
StringStyle=NORMAL
AntiAlias=1
ClipString=1
Hidden=0
;--------------------------
FontFace=#FontName#
FontSize=#FontHeight#
StringAlign=LEFT
StringStyle=NORMAL
AntiAlias=1
ClipString=1
Hidden=0
;--------------------------



and here is what it looks like with my settings:

Image


So basically i just want to get the line with the current date of my work schedule to be highlighted, so i know which day/line of these is my current work day. Maybe - if it's possible - the current in one color (was thinking of green) and the next day in another color (like red or something, so i now which line/date is next, to prepare to.


greets
Soma
User avatar
balala
Rainmeter Sage
Posts: 9039
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Highlighting certain Text based on current Date

balala » June 4th, 2019, 5:27 pm

Please post the content of the C:\Sticky Notes\notes1.txt file as well.
SomaKhaos
Posts: 4
Joined: June 4th, 2019, 3:03 pm

Re: Highlighting certain Text based on current Date

SomaKhaos » June 4th, 2019, 11:29 pm

Ok Sure but it's basically the same like what you see on the picture

Code: Select all

Sa 01.06.19	11:00 - 19:45 Fabrik
So 02.06.19	11:00 - 19:45 Fabrik
Mo 03.06.19	11:00 - 19:45 Fabrik A
Di 04.06.19	Frei
Mi 05.06.19	11:00 - 19:45 Fabrik A
Do 06.06.19	11:00 - 19:45 Fabrik
Fr 07.06.19	11:00 - 19:45 Fabrik
Sa 08.06.19	Frei
So 09.06.19	Frei
Mo 10.06.19	11:00 - 19:45 Fabrik
Di 11.06.19	11:00 - 20:45 Fabrik A
Mi 12.06.19	09:30 - 19:45 Fabrik
Do 13.06.19	09:30 - 19:45 Fabrik
Fr 14.06.19	Frei
Sa 15.06.19	08:30 - 19:15 Fabrik
So 16.06.19	08:30 - 19:15 Fabrik
Mo 17.06.19	08:30 - 19:15 Fabrik
Di 18.06.19	11:00 - 20:45 Fabrik A
Mi 19.06.19	11:00 - 19:45 Fabrik
Do 20.06.19	Frei
Fr 21.06.19	Frei
Sa 22.06.19	11:00 - 19:45 Fabrik
So 23.06.19	11:00 - 19:45 Fabrik
Mo 24.06.19	08:30 - 18:45 Fabrik
Di 25.06.19	08:30 - 18:45 Fabrik
Mi 26.06.19	11:00 - 19:45 Fabrik A
Do 27.06.19	Frei
Fr 28.06.19	Frei
Sa 29.06.19	12:00 - 19:45 City Shop
So 30.06.19	11:00 - 19:45 Fabrik
User avatar
balala
Rainmeter Sage
Posts: 9039
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Highlighting certain Text based on current Date

balala » June 5th, 2019, 7:39 pm

SomaKhaos wrote:
June 4th, 2019, 11:29 pm
Ok Sure but it's basically the same like what you see on the picture
Yep, but I can't use a picture, while if I have this code, I can use it by copying it.
Working on it, however it is much more difficult than I thought it is. Will come back if I find a solution.
User avatar
balala
Rainmeter Sage
Posts: 9039
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Highlighting certain Text based on current Date

balala » June 6th, 2019, 9:42 am

balala wrote:
June 5th, 2019, 7:39 pm
it is much more difficult than I thought it is.
No, it's not. It's an obvious thing but I didn't realize from the beginning (sorry). There is an extremely simple solution: add the following Time measure to your code:

Code: Select all

[MeasureDate]
Measure=Time
Format=%d.%m.%y
This measure returns the current date in the same format as that used into the code (dd.mm.yy).
Add as well the following options to the [Note] meter (beside the existing options):

Code: Select all

[Note]
...
InlineSetting=Color | 255,0,0
InlinePattern=(.*[MeasureDate].*)
DynamicVariables=1
Obviously if you want you can easily change the highlight format. Here I colored the appropriate line to red, but you can use any other setting, available as Inline Options, just have to rewrite the above InlineSetting option.

The above solution highlight always the line of current day. If for this day there is no line, no highlight is shown. If you want to highlight manually certain date, it's even simpler: add a Date=06.06.19 (with the desired date) variable to the [Variables] section and rewrite the InlinePattern option to InlinePattern=(.*#Date#.*). In this case the [MeasureDate] measure isn't even needed anymore, you can get rid of it.
SomaKhaos
Posts: 4
Joined: June 4th, 2019, 3:03 pm

Re: Highlighting certain Text based on current Date

SomaKhaos » June 8th, 2019, 1:19 pm

Thanks alot. This was indeed pretty easy.

Now my question, is it possible to do something like "measureDate+1" to get the date of the next day, to inline it aswell in another color?
User avatar
balala
Rainmeter Sage
Posts: 9039
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Highlighting certain Text based on current Date

balala » June 8th, 2019, 5:28 pm

SomaKhaos wrote:
June 8th, 2019, 1:19 pm
Now my question, is it possible to do something like "measureDate+1" to get the date of the next day, to inline it aswell in another color?
Yep, it definitely is. Add the following measures:

Code: Select all

[MeasureNow]
Measure=Time

[MeasureTomorrow]
Measure=Time
Format=%d.%m.%y
TimeStamp=([MeasureNow:]+86400)
DynamicVariables=1
The [MeasureTomorrow] measure returns the date of the next day (tomorrow). Now you can use this measure to highlight the event of tomorrow. Just add the following two options to the [Note] meter:

Code: Select all

[Note]
...
InlineSetting2=Color | 255,240,0
InlinePattern2=(.*[MeasureTomorrow].*)
According to the InlineSetting2 option, these will color the line of tomorrow to yellow, but you easily can replace the color, if needed.
SomaKhaos
Posts: 4
Joined: June 4th, 2019, 3:03 pm

Re: Highlighting certain Text based on current Date

SomaKhaos » June 8th, 2019, 6:14 pm

Thanks alot. you really helped me :)
User avatar
balala
Rainmeter Sage
Posts: 9039
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Highlighting certain Text based on current Date

balala » June 8th, 2019, 6:16 pm

SomaKhaos wrote:
June 8th, 2019, 6:14 pm
Thanks alot. you really helped me :)
I'm glad.