It is currently September 8th, 2024, 2:34 am

Need to display a quote that changes every 15m, and Quote Plugin isn't working for me.

Get help with creating, editing & fixing problems with skins
CharlesMabe
Posts: 5
Joined: October 2nd, 2021, 11:32 pm

Need to display a quote that changes every 15m, and Quote Plugin isn't working for me.

Post by CharlesMabe »

I have been working for a few hours trying to get https://docs.rainmeter.net/manual/plugins/quote/ working, to no avail. I don't need to use that plugin though. In fact, I'd prefer a method that cycles down a .txt list of quotes, instead of using a randomizer like Quote Plugin. I've been reading topics on doing this with WebParser, but I still don't understand them.

Well, this is what I got so far, after rolling back my attempts at getting Quote Plugin working. As you can see, it's designed so that the text takes up 50% of the desktop space no matter the resolution, sitting in the center, center-aligned. Not only that, but the font size increases or decreases to fill said space with no clipping or cut-off. This is by design. Now I just need to make it pull text every 15 minutes from different quotes in a .txt file.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Variables]
Width=(#SCREENAREAWIDTH#/2)
Height=((#Width# / 16) * 9)
Adjusted=0
TSize=0
Text=Test text. This text will resize to fit no matter how long the text string is; but it is currently a static line of text, and I want to cycle through multiple lines of text instead.

[MeasureTextSize]
Measure=Calc
UpdateDivider=-1
Formula=([MeterText:H])
IfCondition=(([MeasureTextSize]<=#Height#) && (#Adjusted#=0))
IfTrueAction=[!SetVariable TSize (#TSize#+1)][!UpdateMeter "MeterText"][!Redraw]
IfCondition2=(([MeasureTextSize]>#Height#) && (#Adjusted#=0))
IfTrueAction2=[!SetVariable Adjusted 1][!SetVariable TSize (#TSize#-1)][!SetOption MeterText FontColor "255,255,255,255"][!UpdateMeter "MeterText"][!Redraw]
IfConditionMode=1
DynamicVariables=1

[MeterText]
Meter=String
Text=#Text#
AntiAlias=1
ClipString=2
X=(#SCREENAREAWIDTH#/2)
Y=(#SCREENAREAHEIGHT#/4)
W=#Width#
StringAlign=Center
FontColor=FFFFFF
FontSize=#TSize#
FontFace=Source Sans Pro
OnUpdateAction=[!UpdateMeasure "MeasureTextSize"]
UpdateDivider=15
DynamicVariables=1
User avatar
CodeCode
Posts: 1383
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Need to display a quote that changes every 15m, and Quote Plugin isn't working for me.

Post by CodeCode »

Try this thread, it is a basic start to using webparser on a text file.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
jsmorley
Developer
Posts: 22715
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Need to display a quote that changes every 15m, and Quote Plugin isn't working for me.

Post by jsmorley »

Give the specific requirements you mentioned, I don't think either the Quote plugin or WebParser are your best approaches for this. As I see it, what you want is:

1) Have the skin read a file with a list of quotes.
2) Display the quotes, one at a time, in the order they are in the file.
3) When the end is reached, start over.

I would recommend a Lua approach to this.

https://forum.rainmeter.net/viewtopic.php?f=137&t=15162&p=85075

The basic approach is:

1) Read in the "lines" from the .txt file, putting each line into a table.
2) Create a second table that is a copy of the first.
3) On each update, use table.remove() to pop off the first entry in the second table and return it.
4) After the last line in the second table is removed, return to step 2) and re-create the second table. Start over popping them off.

If you change the .txt file, adding, editing or deleting lines, you will just need to refresh the skin when you are done doing so, so that it re-reads the .txt file. You don't want it opening and reading the .txt file more often than required, as that will be a bit resource expensive.

Now that skin is not quite it, as it is "random", which you didn't seem to want, but it could easily be modified to not do it in random order, but in the original order from the file. Just don't sort the second table into a random order.

The Quote plugin is awful for this, as it both hammers your system re-reading the .txt file on each update, and is random in the sense of throwing dice, not random in the sense of drawing a card and discarding it, which means you can easily have "repeats". (the smaller the size of the .txt file the more often things will repeat.

WebParser isn't really good for this either, as one of the things you really have to know is "how many" lines there are in the .txt file. There is no good way to find this out with WebParser.

The only caveat with this is that the .txt file that contains the quotes needs to be encoded as UTF-8 w/o BOM, not UTF-16, as Lua will have trouble reading an external file that is not ANSI (if it does not contain any Unicode characters) or UTF-8 w/o BOM. (if it can contain Unicode characters)
User avatar
jsmorley
Developer
Posts: 22715
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Need to display a quote that changes every 15m, and Quote Plugin isn't working for me.

Post by jsmorley »

So like this perhaps:

SequentialQuote_1.0.rmskin

Lua:

Code: Select all

function Initialize()
   
	quoteTable, currentTable = {}, {}
   
	for line in io.lines(SKIN:MakePathAbsolute('Pithy.txt')) do
		table.insert(quoteTable, line)
	end
	
	SKIN:Bang('!Log', #quoteTable..' items loaded', 'Debug')
   
end

function Update()

	if #currentTable == 0 then
		currentTable = CreateTable(quoteTable)
	end
	
	return table.remove(currentTable, 1)
   
end

function CreateTable(inputTable)

	local secondTable = {}
	
	for inc = 1, #inputTable do
		table.insert(secondTable, inputTable[inc])
	end

	return secondTable
	
end
Skin:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!SetOption MeterQuote W "[#SCREENAREAWIDTH@[#Monitor]]"][!SetOption MeterQuote X "([#SCREENAREAWIDTH@[#Monitor]]/2)"][!UpdateMeter MeterQuote][!Redraw]

[Metadata]
Name=SequentialQuote
Author=JSMorley
Description=Pithy quote every 30 seconds, centered on the monitor.
Instructions=Click to copy to clipboard||Double-click text to open text file with quotes.  Middle click to refresh.||Set variable "Monitor" to the number of the monitor displayed on.
Version=October 3, 2021
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0

[Variables]
Monitor=1
SecondsBetween=30
FontFace=Fira Sans
FontSize=15
FontColor=255,255,255,255

[MeasureQuote]
Measure=Script
ScriptFile=SequentialQuote.lua
UpdateDivider=#SecondsBetween#

[MeterQuote]
Meter=String
MeasureName=MeasureQuote
FontColor=#FontColor#
FontFace=#FontFace#
FontSize=#FontSize#
FontWeight=400
StringAlign=Center
SolidColor=0,0,0,1
AntiAlias=1
LeftMouseUpAction=[!SetClip "[MeasureQuote]"]
LeftMouseDoubleClickAction=["#CURRENTPATH#Pithy.txt"]
MiddleMouseUpAction=!Refresh
Pithy.txt: (UTF-8 w/o BOM)

Code: Select all

42.7 percent of all statistics are made up on the spot.
99 percent of lawyers give the rest a bad name.
A bore is a man who deprives you of solitude without providing you with company.
A closed mouth gathers no foot.
A computer lets you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila.
A conclusion is simply the place where you got tired of thinking.
A crisis is when you can't say "Let's forget the whole thing." 
A day without sunshine is like, night.
A diplomat is someone who can tell you to go to hell in such a way that you will look forward to the trip.
A flashlight is a case for holding dead batteries.
A live plowhorse is still better than a dead thoroughbred. 
A ship in the harbor is safe, but that is not what ships were made for.
A single fact can spoil a good argument.
Age and Treachery Will Always Overcome Youth and Skill
All extremists should be taken out and shot.
All generalizations are false, including this one.
All jobs require you to do things you'd rather not do. That's why they have to pay you.
All software is bug-free, assuming sufficiently clever definitions of "feature" and "expected behaviour".
An honest politician is one who, when he is bought, will stay bought.
An ID card is solely for the purpose of allowing the government to compel you to produce it.
And whose cruel idea was it for the word "Lisp" to have a "S" in it?
Any sufficiently advanced incompetence is indistinguishable from malice.
Any sufficiently advanced technology is indistinguishable from magic. 
Anybody who wants the presidency so much that he'll spend two years organizing and campaigning for it is not to be trusted with the office.
Anything worth taking seriously is worth making fun of.
Artificial Intelligence usually beats real stupidity.
Atheism is a non-prophet organization.
Auntie Em, Hate you, hate Kansas, taking the dog. Dorothy.
Avenge yourself; live long enough to be a problem to your children. 
Be nice to your kids, for it is they who will choose your nursing home. 
Better to understand a little than to misunderstand a lot.
Bills travel through the mail at twice the speed of checks. 
Borrow money from pessimists-they don't expect it back. 
Change is inevitable, except from a vending machine.
Chaos, panic, and disorder - my work here is done.
Complex problems have simple, easy to understand wrong answers. 
Conscience is the inner voice that warns us somebody is looking.
Consciousness: That annoying time between naps.
Death is hereditary.
Democracy must be something more than two wolves and a sheep voting on what to have for dinner. – James Bovard
Despite the cost of living, have you noticed how popular it remains?
Diplomacy is the art of saying "nice doggy" until you can find a rock. 
Disappointment is anger for wimps.
Don't be irreplaceable; if you can't be replaced, you can't be promoted.
Don't be sexist; chicks hate that! 
Don't look back, they might be gaining on you.
Don't make me mad. I'm running out of places to hide the bodies.
Drawing on my fine command of language, I said nothing.
Eagles may soar, but weasels aren't sucked into jet engines. 
Employee of the month is a good example of how somebody can be both a winner and a loser at the same time.
Errors have been made. Others will be blamed.
Even the best of friends cannot attend each other's funeral.
Ever notice that "what the hell" is always the right decision?
Every day I get up and look through the Forbes list of the richest people in America. If I'm not on it, I go to work.
Everyone smiles in the same language.
Everything is funny, as long as it's happening to somebody else.
Experience is something you don't get until just after you need it.
First things first, but not necessarily in that order.
Five out of four people have a problem with fractions. 
For Sale: Parachute. Only used once, never opened, small stain.
Forgive your enemies, but never forget their names. 
Friends help you move. Real friends help you move bodies. 
Friends may come and go, but enemies accumulate. Thomas Jones 
Give me ambiguity or give me something else.
Giving money and power to government is like giving whiskey and car keys to teenage boys. – P.J. O'Rourke
Good judgment comes from bad experience and a lot of that comes from bad judgment.
Gravity: It's not just a good idea. It's the law.
Half the people in the world are above average.
Hard work has a future payoff. Laziness pays off now.
He who smiles in a crisis has found someone to blame.
Health nuts are going to feel stupid someday, lying in hospitals dying of nothing.
Hell hath no fury like the lawyer of a woman scorned. 
Help a man when he is in trouble, and he will remember you when he is in trouble again.
Hey, I was just talking about you. well, not about you specifically, about whores and hypocrisy.
How do you tell when you run out of invisible ink?
How does Teflon stick to the pan?
How many of you believe in telekinesis? Raise my hand.
I’m not a complete idiot, some parts are missing!
I’m writing a book. I’ve got the page numbers done.
I always wanted to be somebody, but now I realize I should have been more specific.
I am not infantile, you stinky poopyhead.
I asked God for a bike, but I know God doesn’t work that way. So I stole a bike and asked for forgiveness.
I can't remember if I'm the good twin or the evil one.
I couldn’t repair your brakes, so I made your horn louder.
I didn’t fight my way to the top of the food chain to be a vegetarian
I didn’t say it was your fault. I said I was going to blame you.
I do not know how the Third World War will be fought, but I know how the Fourth will: with sticks and stones.
I do not participate in any sport with ambulances at the bottom of a hill.
I don’t suffer from insanity. I enjoy every minute of it.
I don't have a solution but I admire the problem.
I don't have to outrun the bear. I only have to outrun you.
I don't mind the voices in my head, it's the ones in yours that bug me. 
I don't necessarily agree with everything I say.
I don't think I'm indecisive. . . 
I don't want to achieve immortality through my work; I want to achieve immortality through not dying. 
I feel like I’m diagonally parked in a parallel universe.
I get enough exercise just pushing my luck.
I hear voices in my head and they say they don't like you. 
I intend to live forever. So far, so good.
I just got lost in thought. It was unfamiliar territory.
I just thought of the best hyperbole
I love deadlines. I like the whooshing sound they make as they fly by.
I need someone really bad. Are you really bad?
I totally take back all those times I didn't want to nap when I was younger.
I used to be schizophrenic, but we're OK now.
I used to have an open mind but my brains kept falling out.
I used to listen to the voices in my head, but I ran out of places to hide the bodies.  
I used to think I was indecisive, but now I'm not so sure.
I worry about you Bevy, I worry a lot.
I'd kill for a Nobel Peace Prize. 
I'm absolutely the single most modest person you will ever meet.
I'm having deja-vu and amnesia at the same time. It's like I think I've forgotten this before
I'm not crazy, I've just been in a very bad mood for 30 years.
I'm not tense, just terribly, terribly alert.
If someone says, "It's not the money, it's the principle of the thing," it's the money.
If after 2 hours in a poker game you are not sure who the pigeon is, you are.
If at first you don’t succeed, destroy all evidence that you tried.
If at first you don't succeed, skydiving is not for you.
If at first you don't succeed, try, try again. Then quit. No use being a damn fool about it.
If I agreed with you we’d both be wrong.
If I had known I was going to live this long, I'd have taken better care of myself. 
If I walked on water people would say I couldn't swim.
If ignorance is bliss, why aren't there more happy people?
If it holds water, it's craft. If it leaks, it's art.
If it isn't broken, fix it until it is.
If things get any worse, I'll have to ask you to stop helping me.
If we aren't supposed to eat animals, why are they made of meat? 
If you can’t convince them, confuse them.
If you can read this, I can slam on my brakes and sue you!
If you have no specific destination in mind you can't be lost.
If you lend someone $20, and never see that person again, it was probably worth it.
If you must choose between two evils, pick the one you've never tried before.
If you tell the truth, you don't have to remember anything.
If you think nobody cares if you're alive, try missing a couple of car payments.
In nature, there are neither rewards nor punishments -- there are consequences.
Inside every older person is a younger person wondering, "What the heck happened?"
Instead of getting married again, I'm going to find a woman I don't like and just give her a house.
Is it time for your medication or mine?
Isn't it interesting that the same people who laugh at science fiction listen to weather forecasts and economists?
It ain't what they call you, it's what you answer to. 
It is bad luck to be superstitious.
It is easier to obtain forgiveness than permission!
It is not necessary to understand things in order to argue about them.
It is seldom that liberty of any kind is lost all at once.
It may be that my whole purpose in life is simply to serve as a warning to others. 
It's been lovely, but I have to scream now. 
It's better to have it and not need it than to need it and not have it. 
It's lonely at the top, but you eat better.
Just because you're paranoid doesn't mean they're not out to get you 
Just practising for my clown college audition.
Knowing too much about each other is exactly why people leave small towns and move to the city.
Knowledge is power, and power corrupts. So study hard and be evil.
Life can only be understood backwards; but it must be lived forwards.
Life is a terminal disease.
Life is what happens to you while you are making other plans.
Live each day as if it were the last day of your life, because so far, it is.
Living on Earth is expensive, But it does include a trip around the sun.
Lottery: A tax on people who are bad at math. 
Love may be blind, but marriage is a real eye opener.
Money isn't everything, but it sure keeps the kids in touch. 
Most problems are either unimportant or impossible to solve.
My kid had sex with your honor student. 
My wife keeps complaining I never listen to her (or something like that).
Never argue with a fool. Someone watching may not be able to tell the difference.
Never ask a barber if he thinks you need a haircut.
Never attribute to malice what can adequately be explained by stupidity. 
Never do your best card tricks for the group you play poker with. 
Never insult an alligator until after you have crossed the river.
Never put off till tomorrow what you can avoid all together.
Never test the depth of the water with both feet.
No good deed ever goes unpunished. 
No man would listen to you talk if he didn't know it was his turn next.
No one is listening until you make a mistake.
Nostalgia isn't what it use to be.
Not everything that can be counted counts, and not everything that counts can be counted
Nothing sucks more than that moment during an argument when you realize you're wrong.
Of all the things I've lost, it's my mind I miss the most. 
Oh Lord, give me patience, and GIVE IT TO ME NOW!
On your mark, get set, go away!
One of the symptoms of an approaching nervous breakdown is the belief that one's work is terribly important.
One out of every four Americans is suffering from some form of mental illness. Think of your three best friends. If they're okay, then it's you.
I plan to be spontaneous tomorrow.
Please don't lie to me, unless you're absolutely sure I'll never find out the truth.
Politicians and diapers have one thing in common. They should both be changed regularly, and for the same reason.
Politics is the gentle art of getting votes from the poor and campaign funds from the rich by promising to protect each from the other.
Pride is what we have. Vanity is what others have.
Problems cannot be solved by the same level of thinking that created them. - Albert Einstein
Procrastinate now.
Puritanism: The haunting fear that someone, somewhere may be happy.
Quickly, I must hurry, for there go my people and I am their leader.
Quoting one is plagiarism. Quoting many is research.
Reality is a crutch for people who can't handle drugs.
Rehab is for quitters.
Remember, if the logs float upstream, they are not logs. 
Remember, it's the second mouse that gets the cheese.
Rock is dead. Long live paper and scissors.
Sex without love is an empty experience, but, as empty experiences go, it's one of the best. 
Some days it's just not worth gnawing through the leather straps.
Some days you are the bug, some days you are the windshield.
Some part of the journey is going to be uphill. 
Some people are only alive because it is illegal to shoot them.
Someday, we'll look back on this, laugh nervously and change the subject.
Sometimes I think war is God's way of teaching us geography.
Stress is when you wake up screaming and you realize you weren't asleep.
Success always occurs in private and failure in full view.
Support mental health or I'll kill you
Taxation WITH representation isn't so hot, either!
Teamwork is wasting half of one's time explaining to others why they are wrong.
The amount of work to be done increases in proportion to the amount of work already completed.
The beatings will continue until morale improves.
The Bible was written by the same people who said the Earth was flat. 
The creative are slaves to their talent, and must answer when it summons. 
The fact that no one understands you doesn't mean you're an artist.
The first ninety percent of the task takes ninety percent of the time, and the last ten percent takes the other ninety percent.
The future will be better tomorrow.
The goal of science is to build better mousetraps. The goal of nature is to build better mice.
The IQ of the group is the lowest IQ of a member of the group divided by the number of people in the group. 
The last thing I want to do is hurt you. But it's still on the list.
The last time politics and religion were mixed, people were burned at the stake.
The lion and the lamb shall lie down together, but the lamb won't get much sleep. 
The nice thing about standards is, there are so many to choose from.
The only change reading about something on the internet will make in someone's opinion is from none to wrong.
The only substitute for good manners is fast reflexes.
The race is not always to the swift, nor the battle to the strong -- but that's usually the way to bet.
The trouble with doing something right the first time is that nobody appreciates how difficult it was. 
The trouble with life is there's no background music. 
The trouble with the gene pool is that there's no lifeguard.
There are 10 types of people in the world. Those who understand binary, and those who don't.
There are no rules here -- we're trying to accomplish something.
There has been an alarming increase in the number of things I know nothing about. 
There's an old proverb that says just about whatever you want it to.
There's never time to do it right, but always time to do it over!
There's no place like 127.0.0.1
They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.
Three out of four voices in my head said I should stay home and clean the guns. 
Time is nature's way of keeping everything from happening all at once.
Timing has an awful lot to do with the outcome of a rain dance.
To err is human, to blame it on somebody else shows management potential.
Today is the first day of the rest of your life. But so was yesterday, and look how you messed that up.
Too many freaks, not enough circuses.
Trust everybody, but cut the cards.
War does not determine who is right – only who is left.
Warning: Dates on calendar are closer than they appear.
We never really grow up, we only learn how to act in public.
We should forgive our enemies, but only after they've been taken out and shot.
We were born naked, wet and hungry. Then things got worse.
We will burn that bridge when we come to it.
Well, this day was a total waste of makeup.
What happens if you get scared half to death twice?
What if the hokey pokey really is what it's all about?
What's another word for Thesaurus?
Whatever kind of look you were going for, you missed.
When all is said and done, more is said than done.
When the government's boot is on your throat, whether it is a left boot or a right boot is of no consequence. – Gary Lloyd
When you are in deep water it's a good idea to keep your mouth shut.
When you gamble, you have to consider losing as one of the possibilities.
When you have eliminated the impossible, whatever remains, however improbable, must be the truth.
Why is "abbreviation" such a long word?
Women need a reason to have sex. Men just need a place
Wrinkled was not one of the things I wanted to be when I grew up!
You can get more with a kind word and a gun than you can with a kind word alone. 
You sound reasonable......time to up my medication.
You're just jealous because the voices only talk to ME.
Your theory is crazy, but it's not crazy enough to be true.
Your village called. They're missing their idiot.
You do not have the required permissions to view the files attached to this post.
CharlesMabe
Posts: 5
Joined: October 2nd, 2021, 11:32 pm

Re: Need to display a quote that changes every 15m, and Quote Plugin isn't working for me.

Post by CharlesMabe »

So I tried this. But like with the previous .ini which was attempting to use Quote Plugin, it will crash Rainmeter if I remove:

Code: Select all

[Variables]
Text=This is test text. This is an extension to the test text for testing slightly longer sentences.
and/or

Code: Select all

[MeterText]
Text=#Text#
Rainmeter will also crash on startup unless I roll back the changes to the .ini, and the logging doesn't record any errors either. I need to change/remove these two things so I can pull quotes from the feed instead of from the static text inside [Variables].

Here's my full .ini so far. (The .lua and .txt seem to be fine, though I edited the .lua to accommodate for a file name change.)

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Metadata]
Name=PerfectQuote
Author=Orphie
Description=Quote every [x] minutes.
Instructions=
Version=0.1
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0

[Variables]
;You can change these variables.
UpdateInSeconds=30
Font=Source Sans Pro
FontWeight=700
FontColor=FFFFFF
ShadowColor=000000

;Do not edit the below variables.
Adjusted=0
TSize=0
Text=This is test text. This is an extension to the test text for testing slightly longer sentences.

[MeasureTextSize]
Measure=Calc
UpdateDivider=-1
Formula=([MeterText:H])
IfCondition=(([MeasureTextSize]<=(((#SCREENAREAWIDTH#/2) / 16) * 9)) && (#Adjusted#=0))
IfTrueAction=[!SetVariable TSize (#TSize#+1)][!UpdateMeter "MeterText"][!Redraw]
IfCondition2=(([MeasureTextSize]>(((#SCREENAREAWIDTH#/2) / 16) * 9)) && (#Adjusted#=0))
IfTrueAction2=[!SetVariable Adjusted 1][!SetVariable TSize (#TSize#-1)][!SetOption MeterText FontColor "255,255,255,255"][!UpdateMeter "MeterText"][!Redraw]
IfConditionMode=1
DynamicVariables=1

[MeasureQuote]
Measure=Script
ScriptFile=PerfectQuote.lua
UpdateDivider=#UpdateInSeconds#

[MeterText]
Meter=String
MeasureName=MeasureQuote
Text=#Text#
FontFace=#Font#
FontSize=#TSize#
FontWeight=#FontWeight#
FontColor=#FontColor#
InlineSetting=Shadow | 2 | 2 | 0 | #ShadowColor#FF
X=(#SCREENAREAWIDTH#/2)
Y=(#SCREENAREAHEIGHT#/4)
W=(#SCREENAREAWIDTH#/2)
AntiAlias=1
ClipString=2
StringAlign=Center
OnUpdateAction=[!UpdateMeasure "MeasureTextSize"]
DynamicVariables=1
CharlesMabe
Posts: 5
Joined: October 2nd, 2021, 11:32 pm

Re: Need to display a quote that changes every 15m, and Quote Plugin isn't working for me.

Post by CharlesMabe »

We've been experimenting, and

Code: Select all

[MeterQuote]
Text=%1
crashes Rainmeter, but

Code: Select all

[MeterQuote]
Text=%1#CRLF#
does not, and the quote cycling works on that, finally. I can't use that though because it breaks the text resizing.

Here's my current .ini:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DefaultDraggable=0
DefaultAlwaysOnTop=-2
MiddleMouseUpAction=!Refresh

[Metadata]
Name=PerfectQuote
Author=Orphie
Description=Quote every [x] minutes.
Instructions=
Version=0.1
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0

[Variables]
;You can change these variables.
UpdateInSeconds=5
Font=Source Sans Pro
FontWeight=700
FontColor=FFFFFF
ShadowColor=000000

;Do not edit the below variables.
Adjusted=0
TSize=0

[MeasureTextSize]
Measure=Calc
UpdateDivider=-1
Formula=([MeterQuote:H])
IfCondition=(([MeasureTextSize]<=(((#SCREENAREAWIDTH#/2) / 16) * 9)) && (#Adjusted#=0))
IfTrueAction=[!SetVariable TSize (#TSize#+1)][!UpdateMeter "MeterQuote"][!Redraw]
IfCondition2=(([MeasureTextSize]>(((#SCREENAREAWIDTH#/2) / 16) * 9)) && (#Adjusted#=0))
IfTrueAction2=[!SetVariable Adjusted 1][!SetVariable TSize (#TSize#-1)][!SetOption MeterQuote FontColor "255,255,255,255"][!UpdateMeter "MeterQuote"][!Redraw]
IfConditionMode=1
DynamicVariables=1

[MeasureQuote]
Measure=Script
ScriptFile=PerfectQuote.lua
UpdateDivider=#UpdateInSeconds#

[MeterQuote]
Meter=String
MeasureName=MeasureQuote
Text=Text Test.
FontFace=#Font#
FontSize=#TSize#
FontWeight=#FontWeight#
FontColor=#FontColor#
InlineSetting=Shadow | 2 | 2 | 0 | #ShadowColor#FF
X=(#SCREENAREAWIDTH#/2)
Y=(#SCREENAREAHEIGHT#/4)
W=(#SCREENAREAWIDTH#/2)
AntiAlias=1
ClipString=2
StringAlign=Center
OnUpdateAction=[!UpdateMeasure "MeasureTextSize"]
LeftMouseDoubleClickAction=["#CURRENTPATH#QuoteList.txt"]
DynamicVariables=1
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5503
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Need to display a quote that changes every 15m, and Quote Plugin isn't working for me.

Post by eclectic-tech »

Your [MeasureTextSize] calc is causing the crashes. The section variable [MeterQuote:H] returns unreliable info and the multiple update and redraw are not needed.

I would suggest modifying [MeasureTextSize] to a calc that monitors the actual #TSize# variable and stops adjusting it when the desired screen width ratio is attained.

This code works for my resolution.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DefaultDraggable=0
DefaultAlwaysOnTop=-2
MiddleMouseUpAction=!Refresh

[Metadata]
Name=PerfectQuote
Author=Orphie
Description=Quote every [x] minutes.
Instructions=
Version=0.1
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0

[Variables]
;You can change these variables.
UpdateInSeconds=5
Font=Source Sans Pro
FontWeight=700
FontColor=FFFFFF
ShadowColor=000000

;Do not edit the below variables.
Adjusted=0
TSize=0

[MeasureTextSize]
Measure=Calc
Formula=#TSize#
IfCondition=(([MeasureTextSize]<=(((#SCREENAREAWIDTH#/2) / 24))) && (#Adjusted#=0))
IfTrueAction=[!SetVariable TSize (#TSize#+1)]
IfCondition2=(([MeasureTextSize]>(((#SCREENAREAWIDTH#/2) / 24))) && (#Adjusted#=0))
IfTrueAction2=[!SetVariable Adjusted 1][!SetVariable TSize (#TSize#-1)][!SetOption MeterQuote FontColor "255,255,255,255"][!SetOption #CurrentSection# IfConditionMode 0]
IfConditionMode=1
DynamicVariables=1

[MeasureQuote]
Measure=Script
ScriptFile=PerfectQuote.lua
UpdateDivider=#UpdateInSeconds#

[MeterQuote]
Meter=String
MeasureName=MeasureQuote
Text=%1
FontFace=#Font#
FontSize=#TSize#
FontWeight=#FontWeight#
FontColor=#FontColor#
InlineSetting=Shadow | 2 | 2 | 0 | #ShadowColor#FF
X=(#SCREENAREAWIDTH#/2)
Y=(#SCREENAREAHEIGHT#/3)
W=(#SCREENAREAWIDTH#/2)
H=(#SCREENAREAHEIGHT#/3)
AntiAlias=1
ClipString=2
StringAlign=Center
OnUpdateAction=[!UpdateMeasure "MeasureTextSize"]
LeftMouseDoubleClickAction=["#CURRENTPATH#QuoteList.txt"]
DynamicVariables=1
I set a height for the [MeterQuote] so ClipString=2 does not clip additional lines of multi-line quotes.
I am not sure what your process for measuring text size was intended to do, so you may want to re-examine the calc.
CharlesMabe
Posts: 5
Joined: October 2nd, 2021, 11:32 pm

Re: Need to display a quote that changes every 15m, and Quote Plugin isn't working for me.

Post by CharlesMabe »

eclectic-tech wrote: October 4th, 2021, 4:49 am Your [MeasureTextSize] calc is causing the crashes. The section variable [MeterQuote:H] returns unreliable info and the multiple update and redraw are not needed.
Whatever your solution is, it doesn't work at all. The first thing it does is increase the text size every second. It eventually stops, but I don't know why it stops. It doesn't end up filling the center-rectangle space as it should, and it doesn't even center properly, and it also clips. So literally nothing works except the feed.

I am trying to get the text to resize on each new quote to fill in the center box as shown below. The previous system actually worked, resizing the text and filling the entire space when I refreshed the skin with different Text= values. The problem is it crashed Rainmeter if Text= was missing or was anything other than a static text, so I couldn't have a feed of quotes.
Untitled.png
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5503
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Need to display a quote that changes every 15m, and Quote Plugin isn't working for me.

Post by eclectic-tech »

Sorry it doesn't work for you. I have been reading centered quotes for the past day using that skin.

Yes, it starts with a text size of zero (which was in your code) and adds 1 to it until the text size fills a set proportion of the ScreenAreaWidth divided by 24, then that measure is not updated. The proportion may need to be changed slightly since it is based on the end users screen width and I did not check all resolutions.

As I said, you may want some different actions... sorry I couldn't help.
CharlesMabe
Posts: 5
Joined: October 2nd, 2021, 11:32 pm

Re: Need to display a quote that changes every 15m, and Quote Plugin isn't working for me.

Post by CharlesMabe »

eclectic-tech wrote: October 4th, 2021, 7:32 pm Sorry it doesn't work for you. I have been reading centered quotes for the past day using that skin.

Yes, it starts with a text size of zero (which was in your code) and adds 1 to it until the text size fills a set proportion of the ScreenAreaWidth divided by 24, then that measure is not updated. The proportion may need to be changed slightly since it is based on the end users screen width and I did not check all resolutions.

As I said, you may want some different actions... sorry I couldn't help.
The text size is supposed to be updated with every new text, and it's also supposed to fill a percentage of the screen so it works for any desktop resolutions.