It is currently September 1st, 2024, 12:35 am
Read a text file into a meter?
-
- Posts: 2
- Joined: February 18th, 2011, 7:17 pm
Read a text file into a meter?
In effect, I have a text file, and I want it on my desktop. My chosen weapon is rainmeter - how can I load this text file and display it, retaining line breaks and tabs and so such?
-
- Developer
- Posts: 22710
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Read a text file into a meter?
Here you go...
This requires the latest Rainmeter 3.0 beta (or later) from http://rainmeter.net. I used tabs in the test .txt file, and then had Lua turn them into 5 space on the way out as Rainmeter is not that crazy about tabs in meters. You can easily change that to any number of spaces in the string.gsub() statement in the .lua. I threw in a blank line to be sure that would work ok.
Sample text file:
This requires the latest Rainmeter 3.0 beta (or later) from http://rainmeter.net. I used tabs in the test .txt file, and then had Lua turn them into 5 space on the way out as Rainmeter is not that crazy about tabs in meters. You can easily change that to any number of spaces in the string.gsub() statement in the .lua. I threw in a blank line to be sure that would work ok.
Sample text file:
Code: Select all
09 AM: Go to bank and finish paperwork.
10 AM: Attend medical appointment.
12 PM: Eat lunch.
01 PM: Shop for household necessities.
03 PM: Shop for food.
05 PM: Prepare dinner for family.
06 PM: Eat dinner with family.
07 PM: Do some cleaning.
08 PM: Оплатить счет за электричество.
09 PM: Relaxation time.
You do not have the required permissions to view the files attached to this post.
-
- Developer
- Posts: 22710
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Read a text file into a meter?
I didn't put it in, but you might want to add:
UpdateDivider=xx
To the Script measure, with "xx" being the number of seconds between checking the text file. You probably don't want to leave it off, as it will check every 1 second, which is probably going to have it working harder than it needs to. I would set it to 5 or 10 or something. You want it to be responsive to changes to the text file, but not ridiculous about it.
UpdateDivider=xx
To the Script measure, with "xx" being the number of seconds between checking the text file. You probably don't want to leave it off, as it will check every 1 second, which is probably going to have it working harder than it needs to. I would set it to 5 or 10 or something. You want it to be responsive to changes to the text file, but not ridiculous about it.
-
- Developer
- Posts: 22710
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Read a text file into a meter?
![Grinning :-)](./images/smilies/ab2.gif)
You do not have the required permissions to view the files attached to this post.
-
- Posts: 2
- Joined: February 18th, 2011, 7:17 pm
Re: Read a text file into a meter?
Excellent, your help both here and through IRC was invaluable. Thanks muchly ![Smiler :)](./images/smilies/ab.gif)
![Smiler :)](./images/smilies/ab.gif)
-
- Developer
- Posts: 22710
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Read a text file into a meter?
My pleasure. Nice chat.
-
- Posts: 4
- Joined: August 10th, 2009, 9:45 pm
Re: Read a text file into a meter?
Hey guys, I was trying to do the same thing as the thread creator, but I was wondering, the skin comes with an "update=1000" line; isn't that supose to be the delay between the reads to the file? should I still add "UpdateDivider=xx"?
In my tests that's what that line does, and it's in miliseconds right?
And another question, can I make the meter clickeable, so it opens the file in notepad?
In my tests that's what that line does, and it's in miliseconds right?
And another question, can I make the meter clickeable, so it opens the file in notepad?
-
- Moderator
- Posts: 995
- Joined: June 10th, 2009, 12:44 pm
- Location: Sweden
Re: Read a text file into a meter?
Update=1000 is used in the [Rainmeter] section to tell rainmeter how often to update the skin.
While in measures you use UpdateDivider or UpdateRate (check the manual when to use what) you delay that specific measure from updating.
Update is in milliseconds, in UpdateDivider and UpdateRate that value is multiplied.
So it will be Update * UpdateRate, or Update * UpdateDivider.
If you don't want to read the textfile on every update, you can add a UpdateDivider to it if you like (add it to the script measure).
Add LeftMouseUpAction=!Execute ["#CurrentPath#Test.txt"]
on the meter.
While in measures you use UpdateDivider or UpdateRate (check the manual when to use what) you delay that specific measure from updating.
Update is in milliseconds, in UpdateDivider and UpdateRate that value is multiplied.
So it will be Update * UpdateRate, or Update * UpdateDivider.
If you don't want to read the textfile on every update, you can add a UpdateDivider to it if you like (add it to the script measure).
Add LeftMouseUpAction=!Execute ["#CurrentPath#Test.txt"]
on the meter.
I don't think, therefore I'm not.
-
- Posts: 1
- Joined: February 22nd, 2012, 5:25 pm
Re: Read a text file into a meter?
Is there any way I could display a text from a website? Example: http://upperboxnetcafe.webs.com/News.txt
-
- Developer
- Posts: 22710
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Read a text file into a meter?
http://rainmeter.net/cms/Tips-WebParserPrimerLordRaiden wrote:Is there any way I could display a text from a website? Example: http://upperboxnetcafe.webs.com/News.txt