It is currently May 1st, 2024, 6:05 pm

Help with text tables.

Get help with creating, editing & fixing problems with skins
Smorkster
Posts: 19
Joined: April 30th, 2012, 12:33 pm

Help with text tables.

Post by Smorkster »

I am trying to show a list of information from a textfile.
The list contains three columns, with name, username, telephone. I have tried to align the columns by using spaces and tabs, but it doesn't really work. They don't align in a straight line.

I have searched the web for many possibilites, like
* using the WebParser
* parse the list as an xml-file
* parsing the file as normal text-file

Now I would like to have some help. Do anyone have some tip on how to do this?

So to clarify, the first column from the list in perfectly align downwards, the other two does not align downwards.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help with text tables.

Post by jsmorley »

Unfortunately, a string meter does not support tabs embedded in data, and unless you use a monospace (and thus ugly) font, spaces won't help much.

What you are going to probably have to do is to parse each field of data as a separate StringIndex using WebParser. Then create a meter for each, (you can reduce both code and effort by using a MeterStyle) using specific X= values for each so they are lined up in in columns in the skin.

This can be hard coded in Rainmeter, with the (for instance) 3 columns of data each with the same Y= value and appropriate X= values, then the next row with a new Y= value and the same 3 X= values as the row above.

Another option is to parse the information in Lua in a loop, then send the X, Y and Text values to the meters in the skin. This can add some flexibility and allow the meters in Rainmeter itself to just be exact copies of a single meter with different names.

In either case this is going to mean a lot of meters, depending on how many "rows" and "columns" you plan to support.

P.S. If you have control over the format of the source data, it will indeed be easiest to parse if it is in some XML'ish format like:

<row>
<data>one</data>
<data>two</data>
<data>three</data>
</row>
<row>
<data>four</data>
<data>five</data>
<data>six</data>
</row>
Smorkster
Posts: 19
Joined: April 30th, 2012, 12:33 pm

Re: Help with text tables.

Post by Smorkster »

Thanks for the help.
Solved it the simple way of having the columns in separate files :)