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

Help: Rainmeter Skins • Re: Help with leading zeroes and counting files in a folder

$
0
0
It makes no sense to add the [!Log ...] bang to the FinishAction of the folder, for two reasons: the folder is only read once at skin load time by the [Folder] measure, and that measure doesn't have DynamicVariables=1 set on it to allow the values of section variables like [Index] to be accurately provided. I suggest adding the bang to an OnUpdateAction in the [Name] measure, which has dynamic variables enabled, is updated once every #Interval# seconds, and can also provide the (full) path and file name as well, if needed:

Code:

[Name]Group=Folder|RandomMeasure=PluginPlugin=FileViewPath=[Folder]Type=FilePathIgnoreCount=1Index=[Index]UpdateDivider=#Interval#OnUpdateAction=[!Log "Current Image: [Name] ([Index])"]DynamicVariables=1
If you wonder, it's "normal" to get two log messages on skin refresh, because the 1st time will be when the skin is read and the first random is generated via updating [Index], and the 2nd time will be when the FinishAction from [Folder] triggers updating [Index] after the folder is read.



The latter is something that I didn't think when posting the above, so if you want to only get one log message at skin refresh (as it would be expected), just add Disabled=1 to [Index] and [Name] to start with them disabled at refresh time, and !Enable that Random group of measures once the FinishAction of [Folder] occurs:

Code:

[Variables]Path=#ROOTCONFIGPATH#ImagesInterval=10[Rainmeter]Update=1000AccurateText=1DynamicWindowSize=1[Metadata]Name=PolaroidAuthor=Mifdy---Measures---[Folder]Measure=PluginPlugin=FileViewRecursive=2Path=#Path#Extensions=jpg;png;bmpFinishAction=[!UpdateMeasureGroup Folder][!EnableMeasureGroup Random][!UpdateMeasureGroup Random][!SetOption Image MeasureName "Name"][!UpdateMeter Image][!Redraw][Count]Group=FolderMeasure=PluginPlugin=FileViewPath=[Folder]Type=FileCountUpdateDivider=-1; [Index]; Group=Random; Measure=Script; ScriptFile=Random.lua; UpdateDivider=#Interval#[Index]Disabled=1Group=RandomMeasure=CalcFormula=RandomLowBound=1HighBound=([Count]=0?1:[Count])UpdateRandom=1UniqueRandom=1UpdateDivider=#Interval#DynamicVariables=1[Name]Disabled=1Group=Folder|RandomMeasure=PluginPlugin=FileViewPath=[Folder]Type=FilePathIgnoreCount=1Index=[Index]UpdateDivider=#Interval#OnUpdateAction=[!Log "Current Image: [Name] ([Index])"]DynamicVariables=1[Caption]Measure=PluginPlugin=QuotePluginPathName=#ROOTCONFIGPATH#Caption.txtUpdateDivider=-1---Meters---[Frame]Meter=ImageX=0Y=50W=444H=530ImageName=#ROOTCONFIGPATH#@Resources\frame.png[Tape]Meter=ImageX=215Y=5W=244H=144ImageName=#ROOTCONFIGPATH#@Resources\tape.png[Scene]Meter=ImageX=28Y=85W=356H=351SolidColor=60,60,60,170[Image]Meter=ImageX=28Y=85W=356H=351PreserveAspectRatio=1UpdateDivider=#Interval#LeftMouseUpAction=[!UpdateMeasureGroup Random][!UpdateMeter Image][!Redraw]DynamicVariables=1[Notes]Meter=StringMeasureName=CaptionFontSize=30SolidColor=0,0,0,1StringAlign=leftFontColor=0,0,0,250FontFace=GINETTEClipString=1Antialias=1Angle=(Rad(-3))X=80Y=490W=310H=65LeftMouseUpAction=[#CURRENTPATH#Caption.txt]MiddleMouseUpAction=[!UpdateMeasure Caption][!UpdateMeter Notes][!Redraw]
P.S. One effect of the above is that you don't need to add the !Log bang to the mouse click action at all, because updating the Random group of measures in that action already takes care of it (since it implicitly triggers the OnUpdateAction from [Name]). So, the above change will log the desired info on click too, without specifically indicating that in the code.
Perfect! Thank you to everyone who's posted in here, I've learned a lot from your help.

Statistics: Posted by Mifdy — Today, 5:46 pm



Viewing all articles
Browse latest Browse all 1836

Trending Articles