Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1538

Help: Rainmeter Skins • Re: Change the color of a text according to a date

$
0
0
Hello everyone and sorry for my English.
I'm looking to change the color of text based on the last modification date of a file.

For this I use Jeffrey Morley's module, LuaTextFile2.0
The module simply reads the contents of a TXT file.

I would like to change the text color based on the last modification date of a specific file.

I try to adapt the module but it doesn't work, maybe the problem is Meter Display

Thank you all for your help.

Sincerely,
You are close to the answer...

Let's start by creating a new variable 'SearchFile' and set it's value to 'test.txt'

Code:

[Variables]SearchFile=test.txt
Now create a FileView parent measure that will search for that filename and return all the file information if found.

Code:

; Reads the 'Path' and contains one file information, if 'SearchFile' is found[MeasureFile]Measure=PluginPlugin=FileViewPath="C:\Temp"ShowDotDot=0ShowFolder=0Count=1WildcardSearch=#SearchFile#
To tell if the parent measure found a file, add a FileView measure that shows the FileCount value of the parent measure

Code:

[MeasureFileCount]Measure=PluginPlugin=FileViewPath=[MeasureFile]Type=FileCount
You can see this in the Rainmeter log (!About)) and should look like this:
timelog.jpg
Now we know if the SearchFile was found and can get the DateModified in a FileView Child measure

Code:

[MeasureFileDate]Measure=PluginPlugin=FileViewPath=[MeasureFile]Index=1Type=FileDateDateType=Modified
Next, we need to know the current time, compare it to MeasureFileDate, and change the fontcolor
If the file is not found, the NUMBER value of [MeasureFileDate] will be zero
Note: IfConditions will ALWAYS use the NUMBER value of the measures, so the Timestamp values are used to compare the dates

Code:

[MeasureTime]Measure=TimeIfCondition=(MeasureFileDate < MeasureTime)&&(MeasureFileDate <> 0)IfTrueAction=[!SetOption MeterDisplay FontColor "255,0,0,255"][!UpdateMeter MeterDisplay][!Redraw]
All that is needed is to display the information

Code:

[MeterDisplay]Meter=StringMeasureName=MeasureFileDateW=300H=500FontFace=Segoe UIFontSize=11FontColor=255,255,255,255SolidColor=0,0,0,1AntiAlias=1ClipString=1Text=FILE: #SearchFile##CRLF#MODIFIED: %1; Condition pour changer la couleur du texte si la date de modification est inférieure à la date d'aujourd'hui; DynamicVariables=1
That corrects the measures in your code.
Let us know if you have any questions.

Code:

[Rainmeter]Author=Jeffrey MorleyUpdate=1000DynamicWindowSize=1[Variables]SearchFile=text.txt; Reads the 'Path' and contains one file information, if 'SearchFile' is found[MeasureFile]Measure=PluginPlugin=FileViewPath="C:\Temp"ShowDotDot=0ShowFolder=0Count=1WildcardSearch=#SearchFile#; Added only for information; Show the number of files found in the parent measure, in the log[MeasureFileCount]Measure=PluginPlugin=FileViewPath=[MeasureFile]Type=FileCount[MeasureFileDate]Measure=PluginPlugin=FileViewPath=[MeasureFile]Index=1Type=FileDateDateType=Modified[MeasureTime]Measure=TimeIfCondition=(MeasureFileDate < MeasureTime)&&(MeasureFileDate <> 0)IfTrueAction=[!SetOption MeterDisplay FontColor "255,0,0,255"][!UpdateMeter MeterDisplay][!Redraw][MeterDisplay]Meter=StringMeasureName=MeasureFileDateW=300H=500FontFace=Segoe UIFontSize=11FontColor=255,255,255,255SolidColor=0,0,0,1AntiAlias=1ClipString=1Text=FILE: #SearchFile##CRLF#MODIFIED: %1; Condition pour changer la couleur du texte si la date de modification est inférieure à la date d'aujourd'hui; DynamicVariables=1

Statistics: Posted by eclectic-tech — Today, 3:09 am



Viewing all articles
Browse latest Browse all 1538

Trending Articles