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.