It is currently April 19th, 2024, 2:30 am

QuotePlugin doesn't update for a blank .txt file

Get help with creating, editing & fixing problems with skins
kaiblue
Posts: 1
Joined: October 2nd, 2020, 6:35 pm

QuotePlugin doesn't update for a blank .txt file

Post by kaiblue »

Hello everyone, I have a fairly simple example that I would appreciate some help with. I am trying to create a [MeterText] that displays the contents of a TextSample.txt file, updating every second. Whenever TextSample.txt changes, the [MeterText] should also change. This mostly works fine. However, when TextSample.txt is empty, then MeterText continues to display the previous text. Whereas, the desired behavior is that the [MeterText] should also display nothing when TextSample.txt is blank.

Does anyone have any idea why this doesn't work? Thanks!

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[MeasureText]
Measure=Plugin
Plugin=QuotePlugin
PathName=C:\TextSample.txt
DynamicVariables=1

[MeterText]
Meter=String
Text=[MeasureText]
FontFace=Helvetica
FontSize=20
FontWeight=500
FontColor=#const_white#
AntiAlias=1 
DynamicVariables=1
User avatar
Alex88
Posts: 92
Joined: July 18th, 2020, 1:23 am
Location: California

Re: QuotePlugin doesn't update for a blank .txt file

Post by Alex88 »

My guess is that is the intended behavior for the plugin, so if the file is completely empty, it skips the file, though I don't know much on the Quote plugin. Trying it now, if you leave some kind of whitespace character (just a normal space works), it will display that line within the file, effectively displaying nothing but a blank space. If that space is still problematic, RegExpSubstitute=1 and Substitute="^ $":"" on the Quote plugin measure [MeasureText] does seem to replace the space, returning nothing as needed.
Last edited by Alex88 on October 3rd, 2020, 1:03 am, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: QuotePlugin doesn't update for a blank .txt file

Post by balala »

kaiblue wrote: October 2nd, 2020, 6:49 pm I am trying to create a [MeterText] that displays the contents of a TextSample.txt file, updating every second. Whenever TextSample.txt changes, the [MeterText] should also change. This mostly works fine. However, when TextSample.txt is empty, then MeterText continues to display the previous text. Whereas, the desired behavior is that the [MeterText] should also display nothing when TextSample.txt is blank.

Does anyone have any idea why this doesn't work?
Sorry being extremely late, but here is a solution, if you still are interested.
The culprit is the encoding of the file being read by the [MeasureText] measure (in this case C:\TextSample.txt). Its encoding is probably UTF-8 (in both Notepad and Notepad++). If you change the encoding to UTF-16 LE (Notepad) or UCS-2 LE BOM (Notepad++), it's gonna work, the skin / String meter will be updated, even if the file is left empty.

However i think a much better idea for this is to use WebParser measure to read the file, not a QuotePlugin measure. Please let me know if you are still interested and want some help with this.