Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1716

Help: Rainmeter Skins • Re: Read contents form a file

$
0
0
There is no measure type called "File".

If the entire and sole contents of the file(s) in question are:

*content of last_number.txt is: 123,456.78 and the file is UTF8
*content of last_update.txt is: 2025-04-01 14:09:54 and the file is UTF8

Then you can use WebParser to read them.

https://docs.rainmeter.net/manual/measures/webparser/

Code:

[MeasureNumber]Measure=WebParserURL=file://C:\rainmeterdata\last_number.txtRegExp=(?siU)^(.*)$StringIndex=1[MeasureLastUpdate]Measure=WebParserURL=file://C:\rainmeterdata\last_update.txtRegExp=(?siU)^(.*)$StringIndex=1
This will read and return the contents every 10 minutes (600 seconds, the default UpdateRate for WebParser). If you need it more often, set an UpdateRate on the WebParser measures that is the number of seconds you want between reads.

You can certainly read the files with LUA as well, but unless you have some additional processing you need to do with LUA on the results, I see no real benefit to jumping out to LUA when WebParser can easily get those contents.
Thank you for the quick reply that was very helpfull, figured my next step would be easier...all but it seems.

The wanted to calculate with the outcome of last_number.tx but whatever i try it keeps returning 0 of nothing.. i tried stripping it from the decimal point but that made no difference either. removed the decimal point myself for testing no luck, simple RegExp nothing seems to work.
The number is written through python in the text soo if that needs altering that i can do..but this :shrug: :-( :oops: :twisted:

Code:

[MeasureNumber]Measure=WebParserURL=file://C:\rainmeterdata\last_number.txtRegExp=(?siU)^(.*)$StringIndex=1Substitute="[^0-9.,]":""[MeasureNumberClean]Measure=CalcFormula=(#CURRENTSECTION# + 0)DynamicVariables=1[MeasureCalulated]Measure=CalcFormula=[MeasureNumberClean] * 0.000911DynamicVariables=1Precision=2[MeterCalculated]Meter=StringMeasureName=MeasureCalculatedMeterStyle=styleRightTextX=250Y=80W=250H=20Text= %1 definite outcome

Statistics: Posted by Macguyver1976 — Yesterday, 9:52 pm



Viewing all articles
Browse latest Browse all 1716

Trending Articles