Hi I am trying to use QuotePlugin to show some quotes. But it only shows them randomly and not in the sequence as they appear in the text file. Is it possible to show the quotes in a sequence?
Besides how is it possible to also show the quotes in the text file appear in a sequence in the ToolTipText function?
It is currently April 20th, 2024, 8:09 am
QuotePlugin sequence
-
- Posts: 16
- Joined: December 28th, 2012, 5:22 pm
- Location: Mumbai, India
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: QuotePlugin sequence
No, the Quote plugin by design obtains a random item. (line from file or image from folder or whatever you point to) In order to have similar functionality sequentially, you would need to use a Lua script, open the file, read it, and use bangs from the script to display the line you want.nickzlapeor wrote:Hi I am trying to use QuotePlugin to show some quotes. But it only shows them randomly and not in the sequence as they appear in the text file. Is it possible to show the quotes in a sequence?
Besides how is it possible to also show the quotes in the text file appear in a sequence in the ToolTipText function?
-
- Moderator
- Posts: 1931
- Joined: January 29th, 2010, 1:43 am
- Location: Willmar, MN
Re: QuotePlugin sequence
Quote.lua
Skin.ini
Code: Select all
function Initialize()
local Text, Pos = {}, 1
local hFile = io.open(SKIN:MakePathAbsolute(SELF:GetOption('File')), 'r')
for word in hFile:lines() do table.insert(Text, word) end
hFile:close()
end -- Initialize
function Update()
local rtext = ''
if #Text > 0 then
rtext = #Text[Pos]
Pos = Pos % #Text + 1
end
return rtext
end -- Update
Code: Select all
[Quote]
Measure=Script
ScriptFile=Quote.lua
File=QuoteFile.txt
[String]
Meter=String
MeasureName=Quote
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
-
- Posts: 16
- Joined: December 28th, 2012, 5:22 pm
- Location: Mumbai, India
Re: QuotePlugin sequence
Hello Thank you for the guidance provided. My skin only shows 0 and not text from the file.
I only changed font values in the skin:
The quotes:
I only changed font values in the skin:
The lua file is as it is. I went through the Lua scripting manual, but I couldn't understand a single thing what needs to be done.[Rainmeter]
Update=1000
[MyQuote]
Measure=Script
ScriptFile=quotes.lua
File=quotes.txt
[String]
Meter=String
MeasureName=MyQuote
FontSize=20
FontFace=Segoe UI
X=0
Y=0
The quotes:
Thank you for replying.Today is Saturday.
Tomorrow is Sunday.
New Year is on Monday.
-
- Moderator
- Posts: 1931
- Joined: January 29th, 2010, 1:43 am
- Location: Willmar, MN
Re: QuotePlugin sequence
This test skin works fine on my system. I did rewrite the Lua script a little. Not because there were errors, just because I thought of a slightly better method.
You do not have the required permissions to view the files attached to this post.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
-
- Posts: 16
- Joined: December 28th, 2012, 5:22 pm
- Location: Mumbai, India
Re: QuotePlugin sequence
Thank you for all the hardwork. This works now. You're a great person!
Edit: No Unicode support?
Edit: No Unicode support?
-
- Moderator
- Posts: 1931
- Joined: January 29th, 2010, 1:43 am
- Location: Willmar, MN
Re: QuotePlugin sequence
Sorry, Lua doesn't (correctly) support Unicode.nickzlapeor wrote:Thank you for all the hardwork. This works now. You're a great person!
Edit: No Unicode support?
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: QuotePlugin sequence
An alternative, that doesn't use the Quote plugin or Lua (which does not do Unicode well) is:
Skin:
Test.txt:
What we are doing is:
Saving the "quotes" in a text file with the file encoding set to UCS-2 Little Endian in your text editor. That way you can save the Unicode characters, and Rainmeter will read them. The file is configured as an "include" file and contains [Variables] set to the value of your quotes. We then @Include this file in the Rainmeter skin.
Setting up a "counter" measure [MeasureCount] to count in a loop from 1 to 4 (the four items in the text file). It is set with UpdateDivider=-1 so it never updates on its own, but will start with "1" and wait for us to manually update it.
Setting up another "counter" measure [MeasureUpdate] to provide the amount of time you want between "changes" of the quote. In this case, I have it set to every 10 seconds (the counter value times the Update=1000 in the [Rainmeter] section.)
When this counter hits "1", it will set the text of the meter to the value of the variable #ItemN# where "N" is the [MeasureCount] counter value from 1 to 4.
After setting the meter text, we update the [MeasureCount] measure, so it changes to the next value from 1 to 4.
This will display each of your quotes, in sequential order, every 10 seconds.
Skin:
Code: Select all
[Rainmeter]
Update=1000
[Variables]
@Include=#CURRENTPATH#Test.txt
[MeasureCount]
Measure=Calc
Formula=(MeasureCount % 4) + 1
UpdateDivider=-1
[MeasureUpdate]
Measure=Calc
Formula=(MeasureUpdate % 10) + 1
IfEqualValue=1
IfEqualAction=[!SetOption MeterQuote Text "#Item[MeasureCount]#"][!UpdateMeter MeterQuote][!Redraw][!UpdateMeasure MeasureCount]
DynamicVariables=1
[MeterQuote]
Meter=String
FontSize=13
FontColor=255,255,255,255
StringStyle=Bold
Antialias=1
Code: Select all
[Variables]
Item1=Today is Saturday.
Item2=Tomorrow is Sunday.
Item3=New Year is on Monday.
Item4=في اليوم التالي هو يوم الثلاثاء
Saving the "quotes" in a text file with the file encoding set to UCS-2 Little Endian in your text editor. That way you can save the Unicode characters, and Rainmeter will read them. The file is configured as an "include" file and contains [Variables] set to the value of your quotes. We then @Include this file in the Rainmeter skin.
Setting up a "counter" measure [MeasureCount] to count in a loop from 1 to 4 (the four items in the text file). It is set with UpdateDivider=-1 so it never updates on its own, but will start with "1" and wait for us to manually update it.
Setting up another "counter" measure [MeasureUpdate] to provide the amount of time you want between "changes" of the quote. In this case, I have it set to every 10 seconds (the counter value times the Update=1000 in the [Rainmeter] section.)
When this counter hits "1", it will set the text of the meter to the value of the variable #ItemN# where "N" is the [MeasureCount] counter value from 1 to 4.
After setting the meter text, we update the [MeasureCount] measure, so it changes to the next value from 1 to 4.
This will display each of your quotes, in sequential order, every 10 seconds.
-
- Posts: 16
- Joined: December 28th, 2012, 5:22 pm
- Location: Mumbai, India
Re: QuotePlugin sequence
It does! Thank you jsmorley for the skin. Thanks a lot!
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: QuotePlugin sequence
Glad to help.nickzlapeor wrote:It does! Thank you jsmorley for the skin. Thanks a lot!