mak_kawa wrote: ↑October 19th, 2018, 10:33 am
"Path=" option of the parent measure of FileView plugin means the name of a folder. So, following code must work, maybe.
Unfortunately it's not so simple. The posted code works
ONLY if the file is the first file of the folder. So, to be precise, if in the
C:\test folder doesn't exist not a single file before
file.txt, because the skin always shows the date of first file.
To can show up the date of needed file, you need to check the name of files and choose the proper one. For this you need a set of FileView plugins which return the names then a measure which returns the appropriate date. Then choosing the file with proper name, you have to show up the date returned by the last measure.
The only problem is that the (parent) FileView plugin counts up to a defined number of files. In the following code I worked with 12 files, supposing that the needed file is ahead of this position. If it's not, well, there is a problem. You can increase the number of returned data, but there anyway is an upper limit. No better solution. Or at least I can't find one.
So, here is my code:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
[Variables]
Index=0
File=file.txt
[mPath]
Measure=Plugin
Plugin=FileView
Path=C:\test
Count=12
[mIndex1Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=1
Group=Children
IfMatch=(?i)#File#
IfMatchAction=[!SetVariable Index "1"]
[mIndex2Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=2
Group=Children
IfMatch=(?i)#File#
IfMatchAction=[!SetVariable Index "2"]
[mIndex3Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=3
Group=Children
IfMatch=(?i)#File#
IfMatchAction=[!SetVariable Index "3"]
[mIndex4Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=4
Group=Children
IfMatch=(?i)#File#
IfMatchAction=[!SetVariable Index "4"]
[mIndex5Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=5
Group=Children
IfMatch=(?i)#File#
IfMatchAction=[!SetVariable Index "5"]
[mIndex6Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=6
Group=Children
IfMatch=(?i)#File#
IfMatchAction=[!SetVariable Index "6"]
[mIndex7Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=7
Group=Children
IfMatch=(?i)#File#
IfMatchAction=[!SetVariable Index "7"]
[mIndex8Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=8
Group=Children
IfMatch=(?i)#File#
IfMatchAction=[!SetVariable Index "8"]
[mIndex9Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=9
Group=Children
IfMatch=(?i)#File#
IfMatchAction=[!SetVariable Index "9"]
[mIndex10Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=10
Group=Children
IfMatch=(?i)#File#
IfMatchAction=[!SetVariable Index "10"]
[mIndex11Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=11
Group=Children
IfMatch=(?i)#File#
IfMatchAction=[!SetVariable Index "11"]
[mIndex12Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=12
Group=Children
IfMatch=(?i)#File#
IfMatchAction=[!SetVariable Index "12"][!UpdateMEasure "MeasureDate"]
[mIndexDate]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileDate
Index=#Index#
DynamicVariables=1
Disabled=1
[MeasureDate]
Measure=Calc
Formula=#Index#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetOption MeterDate Text "#File# doesn't exist."][!UpdateMeter "MeterDate"][!Redraw]
IfFalseAction=[!EnableMeasure "mIndexDate"][!SetOption MeterDate Text "#File# creation date: %1"][!UpdateMeter "MeterDate"][!Redraw]
DynamicVariables=1
[MeterDate]
Meter=STRING
MeasureName=mIndexDate
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
See that as mak_kawa well said, the Path option of the parent FileView measure has to be the path of a folder, not of a file. This is important, if you add the path of a file, the measure doesn't work.
I introduced an Index variable which is used to return the number of the file. You have to add the name of desired file as the File variable, into the [Variables] section. One of the [mIndex1Name] - [mIndex12Name] measures (which finds the file) sets the value of Index variable. If the file is found, the IfFalseAction option of the [MeasureDate] measure enables the [mIndexDate] measure. The Index option of the measure gets the appropriate value and the measure returns the appropriate date. In paralel, the !SetOption bang of the IfFalseAction option of the [MeasureDate] measure sets the Text option of the [MeterDate] meter and the appropriate date is shown up.
As I said, unfortunately I don't see a simpler solution.