It is currently March 29th, 2024, 1:47 am

Read a text file into a meter?

Get help with creating, editing & fixing problems with skins
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Read a text file into a meter?

Post by jsmorley »

If you set ClipString=2 on the String meters, it will "wrap" them automatically if they are too long.
CMDR_Evolution
Posts: 16
Joined: October 30th, 2020, 6:25 pm

Re: Read a text file into a meter?

Post by CMDR_Evolution »

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 :thumbup:
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Read a text file into a meter?

Post by jsmorley »

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 :thumbup:
You might just not specify any H value on the meter, then it will use what it needs and no more.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Read a text file into a meter?

Post by Yincognito »

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! :great:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
CMDR_Evolution
Posts: 16
Joined: October 30th, 2020, 6:25 pm

Re: Read a text file into a meter?

Post by CMDR_Evolution »

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 :D. Have a great weekend chaps
rvindhillon
Posts: 2
Joined: March 8th, 2023, 8:41 am

Re: Read a text file into a meter?

Post by rvindhillon »

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.
You do not have the required permissions to view the files attached to this post.
User avatar
tass_co
Posts: 511
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: Read a text file into a meter?

Post by tass_co »

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"
08.03.2023 - 14.06.55-About Rainmeter.png
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... :great:
rvindhillon
Posts: 2
Joined: March 8th, 2023, 8:41 am

Re: Read a text file into a meter?

Post by rvindhillon »

tass_co wrote: March 8th, 2023, 11:07 am 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"
08.03.2023 - 14.06.55-About Rainmeter.png
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
You do not have the required permissions to view the files attached to this post.
User avatar
tass_co
Posts: 511
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: Read a text file into a meter?

Post by tass_co »

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
Of course, it can be done the way you say.
The important thing here is which method will be more beneficial for you :thumbup:
I don't know where i going from here, but i promise it won't be boring... :great: