It is currently March 27th, 2023, 10:03 am
Read a text file into a meter?
-
- Developer
- Posts: 22564
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Read a text file into a meter?
If you set ClipString=2 on the String meters, it will "wrap" them automatically if they are too long.
-
- Posts: 16
- Joined: October 30th, 2020, 6:25 pm
Re: Read a text file into a meter?
Thanks again jsmorley,
I tried it on the StyleText meter and on the meters themselves but it gives the same effect as ClipString=1. It works if I adjust the height to say two or three times the standard height though. Most commands are one line so it's not too bad. I think I'd rather have more of them opposed to gaps and thanks to your advice, I can consider both of those methods. Cheers
I tried it on the StyleText meter and on the meters themselves but it gives the same effect as ClipString=1. It works if I adjust the height to say two or three times the standard height though. Most commands are one line so it's not too bad. I think I'd rather have more of them opposed to gaps and thanks to your advice, I can consider both of those methods. Cheers

-
- Developer
- Posts: 22564
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Read a text file into a meter?
You might just not specify any H value on the meter, then it will use what it needs and no more.CMDR_Evolution wrote: ↑October 31st, 2020, 7:10 pm Thanks again jsmorley,
I tried it on the StyleText meter and on the meters themselves but it gives the same effect as ClipString=1. It works if I adjust the height to say two or three times the standard height though. Most commands are one line so it's not too bad. I think I'd rather have more of them opposed to gaps and thanks to your advice, I can consider both of those methods. Cheers![]()
-
- Rainmeter Sage
- Posts: 4905
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Read a text file into a meter?
You were right again, jsmorley - it looks like the OP was after the bottom to top file reading, and not navigating through the file contents, after all. Didn't know the TailFile utility was released that "long" ago - nice work! 

-
- Posts: 16
- Joined: October 30th, 2020, 6:25 pm
Re: Read a text file into a meter?
Ah, nice one! That works perfectly. It pushes the bottom rows beneath the window but that doesn't matter at all, as below the window will be off screen from the tablet
. Have a great weekend chaps

-
- Posts: 2
- Joined: March 8th, 2023, 8:41 am
Re: Read a text file into a meter?
Hello, sorry for bringing this thread up from the dead but I'm having a bit of trouble getting my head around using lua.
So what I've got right now is an arduino that has a four temperature sensors hooked up to them. What I've got so far is getting the output from the arduino into a file (reading through pySerial and dumping the output into text).
Using this thread here I've figured out that you can read from the file and display it.
Right now the file's output looks like this:
b'32.0 33.6 30.6 30.6\r\n'
I got as far as displaying it like this: What I'd like to do in rainmeter is have those 4 readings appear as separate meters- but I cant figure out how to parse them that way in the lua script and then integrate that into rainmeter.
Any assistance would be appreciated.
So what I've got right now is an arduino that has a four temperature sensors hooked up to them. What I've got so far is getting the output from the arduino into a file (reading through pySerial and dumping the output into text).
Using this thread here I've figured out that you can read from the file and display it.
Right now the file's output looks like this:
b'32.0 33.6 30.6 30.6\r\n'
I got as far as displaying it like this: What I'd like to do in rainmeter is have those 4 readings appear as separate meters- but I cant figure out how to parse them that way in the lua script and then integrate that into rainmeter.
Any assistance would be appreciated.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 447
- Joined: May 4th, 2020, 3:01 pm
- Location: Ankara, TURKEY
Re: Read a text file into a meter?
rvindhillon wrote: ↑March 8th, 2023, 8:54 am Hello, sorry for bringing this thread up from the dead but I'm having a bit of trouble getting my head around using lua.
So what I've got right now is an arduino that has a four temperature sensors hooked up to them. What I've got so far is getting the output from the arduino into a file (reading through pySerial and dumping the output into text).
Using this thread here I've figured out that you can read from the file and display it.
Right now the file's output looks like this:
b'32.0 33.6 30.6 30.6\r\n'
I got as far as displaying it like this:
Screenshot 2023-03-08 171829.jpg
What I'd like to do in rainmeter is have those 4 readings appear as separate meters- but I cant figure out how to parse them that way in the lua script and then integrate that into rainmeter.
Any assistance would be appreciated.
Write your variable to the String value.
Code: Select all
[MeasureSensor1]
Measure=String
String=32.0 33.6 30.6 30.6
RegExpSubstitute=1
Substitute="(.*) (.*) (.*) (.*)":"\1"
[MeasureSensor2]
Measure=String
String=32.0 33.6 30.6 30.6
RegExpSubstitute=1
Substitute="(.*) (.*) (.*) (.*)":"\2"
[MeasureSensor3]
Measure=String
String=32.0 33.6 30.6 30.6
RegExpSubstitute=1
Substitute="(.*) (.*) (.*) (.*)":"\3"
[MeasureSensor4]
Measure=String
String=32.0 33.6 30.6 30.6
RegExpSubstitute=1
Substitute="(.*) (.*) (.*) (.*)":"\4"
You do not have the required permissions to view the files attached to this post.
I don't know where i going from here, but i promise it won't be boring... 

-
- Posts: 2
- Joined: March 8th, 2023, 8:41 am
Re: Read a text file into a meter?
Ah, I've actually been working on it since I posted that question and found an alternative way to solve my issue. I just got my python script to write to multiple files (1 for each sensor), then have separate lua's to parse each file and then have rainmeter pick up each measure separately.tass_co wrote: ↑March 8th, 2023, 11:07 am Write your variable to the String value.
08.03.2023 - 14.06.55-About Rainmeter.pngCode: Select all
[MeasureSensor1] Measure=String String=32.0 33.6 30.6 30.6 RegExpSubstitute=1 Substitute="(.*) (.*) (.*) (.*)":"\1" [MeasureSensor2] Measure=String String=32.0 33.6 30.6 30.6 RegExpSubstitute=1 Substitute="(.*) (.*) (.*) (.*)":"\2" [MeasureSensor3] Measure=String String=32.0 33.6 30.6 30.6 RegExpSubstitute=1 Substitute="(.*) (.*) (.*) (.*)":"\3" [MeasureSensor4] Measure=String String=32.0 33.6 30.6 30.6 RegExpSubstitute=1 Substitute="(.*) (.*) (.*) (.*)":"\4"
Its not that great for maintenance, but with each widget being separated its a bit more customisable.
I'm going to try your way as well and then decide which way I want to go, since for my purposes I don't need 4 separate widgets.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 447
- Joined: May 4th, 2020, 3:01 pm
- Location: Ankara, TURKEY
Re: Read a text file into a meter?
Of course, it can be done the way you say.rvindhillon wrote: ↑March 8th, 2023, 11:23 am Ah, I've actually been working on it since I posted that question and found an alternative way to solve my issue. I just got my python script to write to multiple files (1 for each sensor), then have separate lua's to parse each file and then have rainmeter pick up each measure separately.
Its not that great for maintenance, but with each widget being separated its a bit more customisable.
I'm going to try your way as well and then decide which way I want to go, since for my purposes I don't need 4 separate widgets.
Screenshot 2023-03-08 192150.jpg
The important thing here is which method will be more beneficial for you

I don't know where i going from here, but i promise it won't be boring... 
