Dear Rainmeter Community,
I have a working Quote skin (after getting help)
https://forum.rainmeter.net/viewtopic.php?f=5&t=28034 and since that time trying to improve it.
Now, it support multiple text file (.txt) stored locally on PC. The skin is not originally coded by me, i just modified it.
I try to add (i hope) one last feature, automatically change FontSize using LUA script. But this is something that is more difficult for me.
Attached all the material of this project.
The relevan short version of the skin is like below
Code: Select all
[Rainmeter]
Author=Pepijn edited and improved by mahtpx120e
;Update=600000
Update=5000
AccurateText=1
[Metadata]
Name=QuotePlus
Description=Displays a quote in the background, fetched from the internet (Offline capability is added by mahtpx120e)
Tags=Daily quote, internet, typography
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
;End of added Metadata
;----------
;VARIABLES
;----------
[Variables]
Hours=5
UpdateQuoteHours=4
CheckNetworkMinutes=5
;Hours=6
;UpdateQuoteHours=12
;CheckNetworkMinutes=3
;1 is equal to 10 minutes (see update value on top)
FontSizeVar=24
;----------
;MEASURES
;----------
;LUA beyondme measure
[MeasureStringLenght]
Disabled=1
Measure=Script
ScriptFile="#CURRENTPATH#LUAScript.lua"
;start offline mode code::::::::::::::::::::::::::::::::::::::
[OfflineQuotationPath]
UpdateDivider=(#Hours#*#UpdateQuoteHours#)
Measure=Plugin
Plugin=QuotePlugin
SubFolders=0
PathName=#CURRENTPATH#QuoteData
FileFilter=*.txt
FinishAction=[!UpdateMeasure OfflineQuotation]
[OfflineQuotation]
UpdateDivider=(#Hours#*#UpdateQuoteHours#)
Measure=Plugin
Plugin=QuotePlugin
PathName=[OfflineQuotationPath]
Separator=##
Substitute=" -- ":"#CRLF#- ",'."':'"'
IfMatch=#CRLF#-
IfMatchAction=[!SetOption MeterOfflineQuote Postfix " -"][!UpdateMeter MeterOfflineQuote]
IfNotMatchAction=[!SetOption MeterOfflineQuote Postfix " "]][!UpdateMeter MeterOfflineQuote]
OnUpdateAction=[!EnableMeasure MeasureStringLenght][!UpdateMeasure MeasureStringLenght]
DynamicVariables=1
;----------
;METERS
;----------
[MeterOfflineQuote]
Meter=String
MeasureName=OfflineQuotation
Text=%1
Meter=String
FontColor=255,255,255,225
FontFace=Calibri
FontSize=#FontSizeVar#
AntiAlias=1
StringAlign=RightCenter
ClipString=1
Padding=5,5,45,5
W=((#SCREENAREAWIDTH#/3)+100)
H=(#SCREENAREAHEIGHT#/2)
X=#SCREENAREAWIDTH#
Y=(#SCREENAREAHEIGHT#/2)
InlineSetting=Weight | 100
InlinePattern=#CRLF#(- .* -)
InlineSetting2=Italic
InlinePattern2=#CRLF#(- .* -)
InlineSetting3=Size | 18
InlinePattern3=#CRLF#(- .* -)
DynamicVariables=1
Code: Select all
function Initialize()
WhatString = SKIN:GetMeasure('OfflineQuotation'):GetStringValue()
StringLength = string.len (WhatString)
end
function Update()
if StringLength > 510 then
SKIN:Bang('!SetVariable', 'FontSizeVar', '20')
SKIN:Bang('!UpdateMeter', 'MeterOfflineQuote')
SKIN:Bang('!Redraw')
elseif StringLength > 650 then
SKIN:Bang('!SetVariable', 'FontSizeVar', '16')
SKIN:Bang('!UpdateMeter', 'MeterOfflineQuote')
SKIN:Bang('!Redraw')
elseif StringLength > 800 then
SKIN:Bang('!SetVariable', 'FontSizeVar', '13')
SKIN:Bang('!UpdateMeter', 'MeterOfflineQuote')
SKIN:Bang('!Redraw')
--elseif --
end
--if necessary uncomment code below
--StringLength = string.len (WhatString)
--return StringLength
end
Sample Of Quotes
"Length 100> Marriage is a wonderful institution, but who would want to live in an institution? -- H. L. Mencken##
"Length 127 > There are two ways of disliking poetry; one way is to dislike it, the other is to read Pope. -- Oscar Wilde on Alexander Pope##
"Length 135> The best time I ever had with Joan Crawford was when I pushed her down the stairs in 'Whatever Happened to Baby Jane?' -- Bette Davis##
"Length 142 > An idealist is one who, on noticing that a rose smells better than a cabbage, concludes that it will also make better soup. -- H. L. Mencken##
"Length 143 > Why am I so good at playing bitches? I think it's because I'm not a bitch. Maybe that's why Miss Crawford always plays ladies. -- Bette Davis##
"Length 194 > Strike an average between what a woman thinks of her husband a month before she marries him and what she thinks of him a year afterward, and you will have the truth about him. -- H. L. Mencken##
"Length 214 > I don't feel we did wrong in taking this great country away from them. There were great numbers of people who needed new land, and the Indians were selfishly trying to keep it for themselves. -- John Wayne, Actor##
"Length 246 > There are two things in life that a sage must preserve at every sacrifice, the coats of his stomach and the enamel of his teeth. Some evils admit of consolations, but there are no comforters for dyspepsia and the toothache. -- Henry Lytton Bulwer##
"Length 298 > Let's be very honest about what this is about. It's not about bashing Democrats, it's not about taxes, they have no idea what the Boston tea party was about, they don't know their history at all. This is about hating a black man in the White House. This is racism straight up. -- Janeane Garofalo##
"Length 503 > Elves are wonderful. They provoke wonder. Elves are marvellous. They cause marvels. Elves are fantastic. They create fantasies. Elves are glamorous. They project glamour. Elves are enchanting. They weave enchantment. Elves are terrific. They beget terror.##
"Length 813> There are, it has been said, two types of people in the world. There are those who, when presented with a glass that is exactly half full, say: this glass is half full. And then there are those who say: this glass is half empty. The world belongs, however, to those who can look at the glass and say: What's up with this glass? Excuse me? Excuse me? This is my glass? I don't think so. My glass was full! And it was a bigger glass! Who's been pinching my beer? And at the other end of the bar the world is full of the other type of person, who has a broken glass, or a glass that has been carelessly knocked over (usually by one of the people calling for a larger glass) or who had no glass at all, because he was at the back of the crowd and had failed to catch the barman's eye. -- Terry Pratchett (The Truth)