It is currently May 1st, 2024, 4:41 pm

Syntax for line-spacing

Get help with creating, editing & fixing problems with skins
jn_meter
Posts: 136
Joined: December 27th, 2016, 12:04 pm

Syntax for line-spacing

Post by jn_meter »

Am I right in thinking that options [in brackets] must all be on one line, as follows?

Code: Select all

IfTrueAction=
[!SetOption meter_value_networkDown MeterStyle style_value_network_trafficIn]
[!SetOption meter_value_networkUp MeterStyle style_value_network_trafficOut]
[!EnableMeasure measure_vpn]
[!ShowMeter meter_vpn]
If so - and certainly the above seems not to work, though neither my linter nor the Rainmeter log show an error - then that makes for some unreadable code!

Apologies if I've failed to find an existing answer to this question.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Syntax for line-spacing

Post by mak_kawa »

To me, it seems to be not right. By your IfTrueAction expression, no action is set, because of no bangs between "=" and "line end"(CRLF).
I am not sure about your bangs, but I think you have to describe it as;

Code: Select all

IfTrueAction=[!SetOption meter_value_networkDown MeterStyle style_value_network_trafficIn][!SetOption meter_value_networkUp MeterStyle style_value_network_trafficOut][!EnableMeasure measure_vpn][!ShowMeter meter_vpn]
Last edited by mak_kawa on April 27th, 2020, 10:28 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Syntax for line-spacing

Post by jsmorley »

Correct. All options in any .ini file must be on a single line.
jn_meter
Posts: 136
Joined: December 27th, 2016, 12:04 pm

Re: Syntax for line-spacing

Post by jn_meter »

Thank you for the information. I think I should post a feature-request. Were line-splitting to become available, it would be like the joyous time that Conkys no longer had to be a single line.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Syntax for line-spacing

Post by jsmorley »

jn_meter wrote: April 27th, 2020, 10:53 pm Thank you for the information. I think I should post a feature-request. Were line-splitting to become available, it would be like the joyous time that Conkys no longer had to be a single line.
As long as Rainmeter uses the .ini file format, it will require that all options be on one line.
jn_meter
Posts: 136
Joined: December 27th, 2016, 12:04 pm

Re: Syntax for line-spacing

Post by jn_meter »

In that case, it seems to be that the it is the format specification that needs revising - or rather, extending. Actually, I take it that some versions of the format have multi-line support already.
User avatar
Yincognito
Rainmeter Sage
Posts: 7185
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Syntax for line-spacing

Post by Yincognito »

jn_meter wrote: April 28th, 2020, 8:02 am In that case, it seems to be that the it is the format specification that needs revising - or rather, extending. Actually, I take it that some versions of the format have multi-line support already.
Yeah, but that can lead to backward compatibility issues. Not to mention including whatever the new format needs in the future builds.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
jn_meter
Posts: 136
Joined: December 27th, 2016, 12:04 pm

Re: Syntax for line-spacing

Post by jn_meter »

I would like to stress the unreadability of something like the following - and it would be worse were it longer.

Code: Select all

IfTrueAction=[!SetOption meter_value_networkDown MeterStyle style_value_network_trafficIn] [!SetOption meter_value_networkUp MeterStyle style_value_network_trafficOut] [!EnableMeasure measure_vpn] [!ShowMeter meter_vpn]
And unreadability makes debugging harder and mistakes easier.
User avatar
Yincognito
Rainmeter Sage
Posts: 7185
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Syntax for line-spacing

Post by Yincognito »

jn_meter wrote: April 28th, 2020, 3:02 pm I would like to stress the unreadability of something like the following - and it would be worse were it longer.

Code: Select all

IfTrueAction=[!SetOption meter_value_networkDown MeterStyle style_value_network_trafficIn] [!SetOption meter_value_networkUp MeterStyle style_value_network_trafficOut] [!EnableMeasure measure_vpn] [!ShowMeter meter_vpn]
And unreadability makes debugging harder and mistakes easier.
True. My longest line in Rainmeter code is 39999 characters, LOL. It's a decoding character substitute used instead of the "built-in" method of decoding characters, as that fails on various occasions (like multiple encodings or rarely used characters, for example).

But then, you have a number of options to shorten them, if you want:
- use variables to store longer, repetitive bangs or substitutes, or even to create "shortcuts" / abbreviations to actual bangs
- use groups to shorten enumerating a list of meters / measures / skins
- use fake meter styles to store repetitive processes
- use @Include to store "modules" of often used code
- use any number of spaces to separate various parts of a long line
- and probably more ...

For example, using variables, your line would be "translated" as:

Code: Select all

[Variables]
SetNetDownStyle=[!SetOption meter_value_networkDown MeterStyle style_value_network_trafficIn]
SetNetUpStyle=[!SetOption meter_value_networkUp MeterStyle style_value_network_trafficOut]
EnableShowVPN=[!EnableMeasure measure_vpn][!ShowMeter meter_vpn]
...
...
...
[YourMeasureOrMeter]
...
IfTrueAction=#SetNetDownStyle##SetNetUpStyle##EnableShowVPN#
Or, you could just use Enter to separate parts of your long line in Notepad++ while "building" the aforementioned line's process, and then when you're done just select those lines and automatically replace the line feed / new line characters with the empty string, in effect making it one line. Won't improve readability or debugging the process afterwards, but it would improve the task of creating the process in the first place.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
jn_meter
Posts: 136
Joined: December 27th, 2016, 12:04 pm

Re: Syntax for line-spacing

Post by jn_meter »

Thank you.

Having line spaces only whilst editing: yes, I thought of that, but, clearly, it is not ideal, especially since, as I wrote, Rainmeter throws no error if one forgets to do the reversion.

The variable trick I did not know. However, can one combine those declarations, thusly?

Code: Select all

SetNetDownStyle=[!SetOption meter_value_networkDown MeterStyle style_value_network_trafficIn][!SetOption meter_value_networkUp MeterStyle style_value_network_trafficOut][!EnableMeasure measure_vpn][!ShowMeter meter_vpn]
If not, then, well. Trying to work out what e.g. 'SetNetDownStyle' means (setting something called NetDown to some style? Doing something when the network is down?) is no fun. Indeed having to do that might be worse than the problem that I have at present! Also, even if one can do the above, it pretty much just moves unreadable code from one place in the script to another place!