Using your text file exactly as it is as Test.txt...
Skin:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
[Variables]
Font=Arial
[MeasureLuaScript]
Measure=Script
ScriptFile=Test.lua
UpdateDivider=30
[QuoteText]
Meter=STRING
X=1
Y=1
W=800
H=600
FontColor=255,255,255,255
FontSize=15
StringAlign=Left
StringStyle=BOLD
FontFace=#Font#
StringEffect=Shadow
FontEffectColor=0,0,0,140
Antialias=1
ClipString=1
Text=Reading...
Code: Select all
function Initialize()
CURRENTPATH = SKIN:GetVariable('CURRENTPATH')
Quotes = {}
i = 0
for line in io.lines(CURRENTPATH..'Test.txt') do
if string.sub(line, 1, 7) == '<title>' then
i = i + 1
Quotes[i] = string.sub(line, 8)
else
Quotes[i] = Quotes[i]..'#CRLF#'..line
end
end
end -->Initialize
function Update()
rand = math.random(1, #Quotes)
SKIN:Bang('!SetOption QuoteText Text """'..Quotes[rand]..'"""')
return 'Quote number: '..rand
end -->Update
Then on each update of the Lua script (every 30 seconds in my sample) it generates a random number between 1 and the total number of quotes (#Quotes = Total number of items in the table) and sets the Text= option of the meter with the selected random quote.
One measure in the skin instead of 100 or more...
Let me know if you have any interest in this approach and need any questions answered about what or why or how it works.