How add a single sp...
 
Notifications
Clear all

We had a major storm through here recently and we suffered damage to the house roof and ceilings. I just received the quote to repair. I’m hoping that a small fraction of the 80,000 odd people that download SDIO and/or Desktop Info every month won’t mind chipping in a few dollars to help out. Click on the big blue button at the bottom of the page to help us keep a roof over our heads, literally!

Guests have read-only access to our forums. If you wish to participate you will need to register. Be sure to activate your account from the email sent to you when you register.

How add a single space to a number when no K/M/G in [3.0B] (

4 Posts
2 Users
0 Reactions
1,542 Views
(@aleksashka)
Active Member Registered
Joined: 7 months ago
Posts: 9
Topic starter  

 

 

First of all - thank you very much for such an astonishing program as well as documentation!

Up until now I was able to solve things just by reading the manual. Very well written.

Unfortunately, now I faced an issue which I cannot resolve on my own..

Here is a snippet from my desktopinfo.ini:

NETWORKPERF=\
    interval:1,\
    row-text:Netw,\
    log-counters:1,\
    local:0,\
    hide-no-result:1,\
    chart:line row-id:%instance% max:{{Log10(%CurrentBandwidth%/8)}} series1:{{Log10(Max(1\,%BytesReceivedPersec%))}} color1:#008f00 series2:{{Log10(Max(1\,%BytesSentPersec%))}} height:2 color2:#00008f,\
    alarms:(%BytesReceivedPersec% ge {{%CurrentBandwidth%/8*70/100}} #ff8800)(%BytesReceivedPersec% ge {{%CurrentBandwidth%/8*85/100}} #ff0000)(%BytesSentPersec% ge {{%CurrentBandwidth%/8*70/100}} #ff8800)(%BytesSentPersec% ge {{%CurrentBandwidth%/8*85/100}} #ff0000),\
    display:{{{{{%BytesReceivedPersec%*8}}[3.0B]}}}bps / {{{{{%BytesSentPersec%*8}}[3.0B]}}}bps

The problem is with the following part:

{{%BytesReceivedPersec%*8}}[3.0B]

I would like numbers to occupy a constant number of places (I use a monotype font) so that following "bps" do not move around.

On numbers' update I have iterations like this:

120Kbps
 20Mbps
284bps
130Kbps

I would like to add a space before bps in case no letters are used and have this instead:

120Kbps
 20Mbps
284 bps
130Kbps

As far as I understand an IF item is not supposed to go into another item (NETWORKPERF in my case).

 

Could you please suggest a solution to this case?

 

Thank you

 

P.S.

I noticed that %21 of OSBUILD2 on Windows 11 returns "Windows 10", so for now I use the following to create a short "Win 11 Pro (24H2)":

OSBUILD2=\
    regex:Microsoft |dows,\
    text:OS,\
    display:%1 (%18)

 

This topic was modified 7 months ago 2 times by aleksashka

   
Quote
Glenn
(@glenn)
Member Admin
Joined: 7 years ago
Posts: 1834
 

Posted by: @aleksashka

First of all - thank you very much for such an astonishing program as well as documentation!

Up until now I was able to solve things just by reading the manual. Very well written.

You're most welcome. Nice to know the manual is getting some use 🙂

Posted by: @aleksashka

I would like to add a space before bps in case no letters are used

I couldn't find a solution to this problem. So i've added 2 new format styles in the next release:

'BS' is the same as 'B' but will insert a space when the value is less than 1K

'bs' is the same as 'b' but will insert 2 spaces when the value is less than 1Ki

Posted by: @aleksashka

As far as I understand an IF item is not supposed to go into another item (NETWORKPERF in my case).

I don't know what this means.

Posted by: @aleksashka

I noticed that %21 of OSBUILD2 on Windows 11 returns "Windows 10",

You'll notice OSBUILD2 has 2 return values for operating system, one comes from WMI, the other comes from the registry. On Win11 they are different. Go figure!  🙂


   
ReplyQuote
(@aleksashka)
Active Member Registered
Joined: 7 months ago
Posts: 9
Topic starter  

Posted by: @glenn

So i've added 2 new format styles in the next release

Great! Looking forward to it!

Posted by: @aleksashka

As far as I understand an IF item is not supposed to go into another item (NETWORKPERF in my case).

I was thinking about the possibility to use IF inside the display: of the NETWORKPERF.
Something like this:

Pseudo-code:                                   +adding the space manually     ++not adding the space
                                               |                              ||
display: IF Bps*8 < 1000 return {{Bps*8}}[3.0f] bps else return {{Bps*8}}[3.0B]bps

But your update with BS/bs is going to be way cleaner 🙂

I was also thinking about using regexR, but could not find an example of using it, so I don't even know what syntax is supposed to be used with it. Is it possible to provide an example of using it in the manual and/or sample-config?

Thank you!


   
ReplyQuote
Glenn
(@glenn)
Member Admin
Joined: 7 years ago
Posts: 1834
 

Posted by: @aleksashka

I was also thinking about using regexR, but could not find an example of using it, so I don't even know what syntax is supposed to be used with it. Is it possible to provide an example of using it in the manual and/or sample-config?

regex is applied to the raw data before it gets to the display. There's a short discussion in the manual. I'm not the expert. There's a good tutorial at: https://www.regular-expressions.info/

 

Posted by: @aleksashka

Pseudo-code: IF Bps*8 < 1000 return {{Bps*8}}[3.0f] bps else return {{Bps*8}}[3.0B]bps

you could probably achieve something like that if you set your mind to it...


   
ReplyQuote
Glenn's Page