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

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

$
0
0
I have a couple of friends using this skin and they've pointed out a quirk I hadn't noticed before. Sometimes (but not every time) when Rainmeter first loads, or when you reload the skin, one of the images will load for about second before switching to another. It's always 002.png in my case. All of the images are labelled numerically, so for some reason it's always the second picture that flashes up.
Ok, tried your code, photoshopped some images roughly based on your video (which you can ignore, I guess, as they were for my tests), and I also got the 2nd image showing up briefly on refreshing - by the way, one can make the behavior persistent if he keeps the About > Skins tab open, as that slows down Rainmeter a bit. So I adjusted the code here and there to avoid the issue (which was caused partially by your code omissions and partly by the fact that FileView takes a bit to retrieve its data compared to the much faster Lua process)...

[SkinFolder]\Caption.txt:

Code:

Some Text 1Some Text 2Some Text 3Some Text 4Some Text 5Some Text 6Some Text 7Some Text 8Some Text 9Some Text 10Some Text 11Some Text 12
[SkinFolder]Random.lua:

Code:

function Initialize()  msCount = SKIN:GetMeasure('Count')  currentTable = {}endfunction Update()  fileCount = msCount:GetValue()  if #currentTable == 0 then    currentTable = RandomOrder(fileCount)  end  return table.remove(currentTable)endfunction RandomOrder(inputCount)  assert(type(inputCount) == 'number', ('RandomOrder must receive a number. Received %s instead.'):format(type(inputCount)))  local sortedTable, unsortedTable = {}, {}  for inc = 1, inputCount do    unsortedTable[inc] = inc  end  math.randomseed(tonumber(tostring(os.time()):reverse():sub(1,6)))  while #unsortedTable > 0 do    table.insert(sortedTable, table.remove(unsortedTable, math.random(1, #unsortedTable)))  end  unsortedTable = nil  return sortedTableend
[SkinFolder]\@Resources\frame.png:
frame.png
[SkinFolder]\@Resources\tape.png:
tape.png
[SkinFolder]\Skin.ini:

Code:

[Variables]Path=#ROOTCONFIGPATH#ImagesInterval=3600[Rainmeter]Update=1000AccurateText=1DynamicWindowSize=1[Metadata]Name=PolaroidAuthor=Mifdy---Measures---[Random]Measure=ScriptScriptFile=Random.luaUpdateDivider=#Interval#[Folder]Measure=PluginPlugin=FileViewShowDotDot=0Recursive=2Path=#Path#Extensions=jpg;png;bmpFinishAction=[!UpdateMeasure Count][!UpdateMeasure Random][!UpdateMeasure Name][!UpdateMeter Image][!ShowMeter Image][!Redraw][Count]Measure=PluginPlugin=FileViewPath=[Folder]Type=FileCount[Name]Measure=PluginPlugin=FileViewPath=[Folder]Type=FilePathIgnoreCount=1Index=[Random]DynamicVariables=1[Caption]Measure=PluginPlugin=QuotePluginPathName=#ROOTCONFIGPATH#Caption.txt;Separator=¶UpdateDivider=-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]Hidden=1Meter=ImageX=28Y=85W=356H=351MeasureName=NamePreserveAspectRatio=1LeftMouseUpAction=[!UpdateMeasure Random][!UpdateMeasure Name][!UpdateMeter *][!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. Neither your code nor this one monitors the Images folder for changes, so a skin refresh is needed to handle that when needed. I left that part the same as I didn't want to complicate matters, but for the record, doing that without refreshing is possible like this. That being said, other small adjustments to the code in that case would be needed, so if you want to keep it the simplest as possible, feel free to skip tackling that.

Statistics: Posted by Yincognito — Yesterday, 7:16 pm



Viewing all articles
Browse latest Browse all 720

Trending Articles