Community discussions

MikroTik App
 
User avatar
diamuxin
Member
Member
Topic Author
Posts: 319
Joined: Thu Sep 09, 2021 5:46 pm
Location: Alhambra's City

Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 12:55 pm

Hi,

I want to make a function to get the traffic on an interface and convert the unit correctly to B, KiB, MiB or GiB depending on the size. Just like Winbox does automatically:

Image

I have tried this script but it doesn't work, any help please?
{
:local 1 ([/interface get pppoe-out1]->"rx-byte")
:local human do={
    :local input $1; 
    :local q; 
    :local r; 
    :local output;
    :if ($input<1024) do={:set output "$input B"} 
    else={
	    :if ($input<1048576) do={:set q ($input/1024); 
        :set r ($input-$q*1024); 
        :set r ($r/102); 
        :set output "$q.$r KiB"
        } 
        else={
	    :if ($input<1073741824) do={:set q ($input/1048576); 
        :set r ($input-$q*1048576); 
        :set r ($r/104858); 
        :set output "$q.$r MiB"
        } 
        else={
		:set q ($input/1073741824); 
        :set r ($input-$q*1073741824); 
        :set r ($r/107374182); 
        :set output "$q.$r GiB"
	    }
        }
    }
	:return [$output]
}
:put $human
}
Thanks & BR.
 
msatter
Forum Guru
Forum Guru
Posts: 2897
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 1:57 pm

What have you tried till now to get the script running?

There are several things wrong in the script.

The first one is that $1 is used and that is a special variable in a function and contains the first value transferred by the call function. So using it here invalids the :local 1. Use sound variable names.
Then the else { have to be on the same line as the :if
Then calling the function responds with the Eval code used by Mikrotik and is translation of your code to 'directly executable' code in ROS. If you put [ ] around the name of the function caller then it will return the calculated value instead of the Eval code

That's all folks....
Last edited by msatter on Thu Feb 03, 2022 2:28 pm, edited 2 times in total.
 
User avatar
diamuxin
Member
Member
Topic Author
Posts: 319
Joined: Thu Sep 09, 2021 5:46 pm
Location: Alhambra's City

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 2:20 pm

What have you tried till now to get the script running?

Try replace :set by :set $ in the whole script.
Sorry, I'm not an advanced programmer. I have already fixed the variables.

I have tried with a terminal and within a script
{
:local 1 ([/interface get pppoe-out1]->"rx-byte")
:local human do={
    :local input $1; 
    :local q; 
    :local r; 
    :local output;
    :if ($input<1024) do={:set $output "$input B"} 
    else={
	    :if ($input<1048576) do={:set $q ($input/1024); 
        :set $r ($input-$q*1024); 
        :set $r ($r/1024); 
        :set $output "$q.$r KiB"
        } 
        else={
	    :if ($input<1073741824) do={:set $q ($input/1048576); 
        :set $r ($input-$q*1048576); 
        :set $r ($r/104858); 
        :set $output "$q.$r MiB"
        } 
        else={
		:set $q ($input/1073741824); 
        :set $r ($input-$q*1073741824); 
        :set $r ($r/107374182); 
        :set $output "$q.$r GiB"
	    }
        }
    }
	:return [$output]
}
:put $human
}
It doesn't work, it gives me the first error in the first "else="

BR.
 
afuchs
Frequent Visitor
Frequent Visitor
Posts: 81
Joined: Wed Jul 03, 2019 11:10 am

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 3:27 pm

I don't know, what you want to archive, but perhaps the 'monitor ' command could be something for you,
but I have no idea if you can isolate one of the parameters.
/interface monitor-traffic duration=1 ether4

                         name:   ether4
        rx-packets-per-second:        0
           rx-bits-per-second:     0bps
     fp-rx-packets-per-second:        0
        fp-rx-bits-per-second:     0bps
          rx-drops-per-second:        0
         rx-errors-per-second:        0
        tx-packets-per-second:        6
           tx-bits-per-second:  3.7kbps
     fp-tx-packets-per-second:        6
        fp-tx-bits-per-second:  3.5kbps
          tx-drops-per-second:        0
    tx-queue-drops-per-second:        0
         tx-errors-per-second:        0


 
User avatar
diamuxin
Member
Member
Topic Author
Posts: 319
Joined: Thu Sep 09, 2021 5:46 pm
Location: Alhambra's City

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 4:45 pm

I don't know, what you want to archive, but perhaps the 'monitor ' command could be something for you,
but I have no idea if you can isolate one of the parameters.
/interface monitor-traffic duration=1 ether4

                         name:   ether4
        rx-packets-per-second:        0
           rx-bits-per-second:     0bps
     fp-rx-packets-per-second:        0
        fp-rx-bits-per-second:     0bps
          rx-drops-per-second:        0
         rx-errors-per-second:        0
        tx-packets-per-second:        6
           tx-bits-per-second:  3.7kbps
     fp-tx-packets-per-second:        6
        fp-tx-bits-per-second:  3.5kbps
          tx-drops-per-second:        0
    tx-queue-drops-per-second:        0
         tx-errors-per-second:        0


Thanks, but that solution doesn't work for me.

I am making a script to obtain every x times the information of the traffic that passes in the "pppoe-out1" interface.
:local txtotal (([/interface get [find name=pppoe-out1] tx-byte])/1073741824);
:local rxtotal (([/interface get [find name=pppoe-out1] rx-byte])/1073741824);
:local DeviceName [/system identity get name];

/tool e-mail send to="user@gmail.com" from="Mikrotik $DeviceName" \
    subject="\F0\9F\9A\80 $DeviceName Traffic Status" body="<i>Total Traffic:</i> \
    \nDownload: $rxtotal GBs\nUpload: $txtotal GBs\nTotal: $(txtotal+rxtotal) GBs";

:log info "Sent Email: Traffic Status"
It works fine but it is built to get values >1 GBs (/1073741824) but when the traffic is <1 GB the value I get = 0.

I have seen this sequence in this forum to convert values of the variables "tx-total" and "rx-total" so that they can be displayed correctly by a person regardless of the value obtained. (Bytes or KiB or MiB or GiB).

the following function is what i could find to adapt it to my script:
{
:local 1 ([/interface get pppoe-out1]->"rx-byte")
:local human do={
    :local input $1; 
    :local q; 
    :local r; 
    :local output;
    :if ($input<1024) do={:set $output "$input B"} 
    else={
	    :if ($input<1048576) do={:set $q ($input/1024); 
        :set $r ($input-$q*1024); 
        :set $r ($r/1024); 
        :set $output "$q.$r KiB"
        } 
        else={
	    :if ($input<1073741824) do={:set $q ($input/1048576); 
        :set $r ($input-$q*1048576); 
        :set $r ($r/104858); 
        :set $output "$q.$r MiB"
        } 
        else={
		:set $q ($input/1073741824); 
        :set $r ($input-$q*1073741824); 
        :set $r ($r/107374182); 
        :set $output "$q.$r GiB"
	    }
        }
    }
	:return [$output]
}
:put $human
}
BR.
 
msatter
Forum Guru
Forum Guru
Posts: 2897
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 5:12 pm

Reread my earlier posting.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3291
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 5:21 pm

This should convert the data to your need:
{
:local Type
:local Bytes ([/interface get pppoe-out1]->"rx-byte")
:if (($Bytes/1073741824)>0) do={
	:set $Bytes ($Bytes/1073741824)
	:set $Type "GB"
} else={
	:if (($Bytes/1048576)>0) do={
		:set $Bytes ($Bytes/1048576)
		:set $Type "MB"
	} else={
		:if (($Bytes/1024)>0) do={
			:set $Bytes ($Bytes/1024)
			:set $Type "KB"
		} else={
			:set $Type "B"
		}
	}
}

:put "$Bytes $Type"
}
A simpler version. Less if else.
{
:local Type "B"
:local Bytes ([/interface get ether1]->"rx-byte")
:local Output $Bytes

:if (($Bytes/1024)>0) do={
	:set $Output ($Bytes/1024)
	:set $Type "KB"
}

:if (($Bytes/1048576)>0) do={
	:set $Output ($Bytes/1048576)
	:set $Type "MB"
}

:if (($Bytes/1073741824)>0) do={
	:set $Output ($Bytes/1073741824)
	:set $Type "GB"
}

:if (($Bytes/1099511627776)>0) do={
	:set $Output ($Bytes/1099511627776)
	:set $Type "TB"
}

:put "$Output $Type"
}
 
msatter
Forum Guru
Forum Guru
Posts: 2897
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 5:35 pm

One does don't learn from copy-and-paste.
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3253
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 5:38 pm

There are several things wrong in the script.

The first one is that $1 is used and that is a special variable in a function and contains the first value transferred by the call function. So using it here invalids the :local 1. Use sound variable names.
Actually was curious the ":local 1 ..." usage – I would have thought be the error here. But instead it overrides any argument that would have been in $1. Guess that make sense but variables starting with a number is something I avoid. But for reassignment of the positional arguments, unintentionally cleaver.

I have seen this sequence in this forum to convert values of the variables "tx-total" and "rx-total" so that they can be displayed correctly by a person regardless of the value obtained. (Bytes or KiB or MiB or GiB).


I think the script problem is it's not really a function any more. So if you change "human" from :local to :global, then use the $human function whatever you want. I added some protection around invalid types being provided, but assuming the rest of the B,K,M logic is right...
:global human do={
    :if ([:typeof $1]="nothing") do={
        :error "must provide a byte value to humanize";
    };
    :local input [:tonum $1]; 
    :if ([:typeof $input]!="num") do={
        :error "cannot convert $1 to number";
    };
    :local q; 
    :local r; 
    :local output;
    :if ($input<1024) do={
        :set $output "$input B";
    } else={
        :if ($input<1048576) do={
            :set q ($input/1024); 
            :set r ($input-$q*1024); 
            :set r ($r/102); 
            :set output "$q.$r KiB";
        } else={
            :if ($input<1073741824) do={
                :set q ($input/1048576); 
                :set r ($input-$q*1048576); 
                :set r ($r/104858); 
                :set output "$q.$r MiB"
            } else={
                :set q ($input/1073741824); 
                :set r ($input-$q*1073741824); 
                :set r ($r/107374182); 
                :set output "$q.$r GiB"
            }
        }
    }
	:return $output
};

So to use this you "call" $human with the results of a "/interface/get" command that returns with bytes. If you want to print it to the console (instead of using $human in a script), you can add a put like below to see the returned value from $human:
:put [$human [/interface get lte2 tx-byte]] 
# 1.4 GiB
or assign it to variable to use and/or use string interpolation:
{
	# in a script, block, you can assign it to variable to then use in email script
	:local ltetx [$human [/interface get lte2 tx-byte]]
	:put $ltetx

	# alternatively in a string using interpolation
	:local strtxrx "TX is $([$human [/interface get lte2 tx-byte]] and RX is $([$human [/interface get lte2 rx-byte]])) 
}
Last edited by Amm0 on Thu Feb 03, 2022 5:46 pm, edited 1 time in total.
 
User avatar
diamuxin
Member
Member
Topic Author
Posts: 319
Joined: Thu Sep 09, 2021 5:46 pm
Location: Alhambra's City

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 5:40 pm

Reread my earlier posting.
Sorry, I had not seen that I had edited the post
Then calling the function responds with the Eval code used by Mikrotik and is translation of your code to 'directly executable' code in ROS. If you put [ ] around the name of the function caller then it will return the calculated value instead of the Eval code
I have not understood anything!
(Not all of us are experts like you)

Thanks.
Last edited by diamuxin on Thu Feb 03, 2022 5:48 pm, edited 1 time in total.
 
User avatar
diamuxin
Member
Member
Topic Author
Posts: 319
Joined: Thu Sep 09, 2021 5:46 pm
Location: Alhambra's City

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 5:41 pm

One does don't learn from copy-and-paste.
You are right, that's why I ask in the forum, to learn.

BR.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3291
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 5:52 pm

This is one good one :)
PS I learned most of my stuff from copy/past and study...
{
:local Bytes ([/interface get pppoe-out1]->"rx-byte")
:local Type [:toarray "B,KB,MB,GB,TB,PB,EB"]
:local Counter 0
:while ($Bytes > 1024) do={
	   :set $Bytes ($Bytes/1024)
	   :set $Counter ($Counter+1)
      }
:local Prefix [:pick $Type $Counter]
:put "$Bytes$Prefix"
}
Last edited by Jotne on Thu Feb 03, 2022 7:47 pm, edited 1 time in total.
 
User avatar
diamuxin
Member
Member
Topic Author
Posts: 319
Joined: Thu Sep 09, 2021 5:46 pm
Location: Alhambra's City

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 5:55 pm

There are several things wrong in the script.

The first one is that $1 is used and that is a special variable in a function and contains the first value transferred by the call function. So using it here invalids the :local 1. Use sound variable names.
Actually was curious the ":local 1 ..." usage – I would have thought be the error here. But instead it overrides any argument that would have been in $1. Guess that make sense but variables starting with a number is something I avoid. But for reassignment of the positional arguments, unintentionally cleaver.

I have seen this sequence in this forum to convert values of the variables "tx-total" and "rx-total" so that they can be displayed correctly by a person regardless of the value obtained. (Bytes or KiB or MiB or GiB).


I think the script problem is it's not really a function any more. So if you change "human" from :local to :global, then use the $human function whatever you want. I added some protection around invalid types being provided, but assuming the rest of the B,K,M logic is right...
:global human do={
    :if ([:typeof $1]="nothing") do={
        :error "must provide a byte value to humanize";
    };
    :local input [:tonum $1]; 
    :if ([:typeof $input]!="num") do={
        :error "cannot convert $1 to number";
    };
    :local q; 
    :local r; 
    :local output;
    :if ($input<1024) do={
        :set $output "$input B";
    } else={
        :if ($input<1048576) do={
            :set q ($input/1024); 
            :set r ($input-$q*1024); 
            :set r ($r/102); 
            :set output "$q.$r KiB";
        } else={
            :if ($input<1073741824) do={
                :set q ($input/1048576); 
                :set r ($input-$q*1048576); 
                :set r ($r/104858); 
                :set output "$q.$r MiB"
            } else={
                :set q ($input/1073741824); 
                :set r ($input-$q*1073741824); 
                :set r ($r/107374182); 
                :set output "$q.$r GiB"
            }
        }
    }
	:return $output
};

So to use this you "call" $human with the results of a "/interface/get" command that returns with bytes. If you want to print it to the console (instead of using $human in a script), you can add a put like below to see the returned value from $human:
:put [$human [/interface get lte2 tx-byte]] 
# 1.4 GiB
or assign it to variable to use and/or use string interpolation:
{
	# in a script, block, you can assign it to variable to then use in email script
	:local ltetx [$human [/interface get lte2 tx-byte]]
	:put $ltetx

	# alternatively in a string using interpolation
	:local strtxrx "TX is $([$human [/interface get lte2 tx-byte]] and RX is $([$human [/interface get lte2 rx-byte]])) 
}
Thanks for the explanation, now I understand.

BR.
 
User avatar
diamuxin
Member
Member
Topic Author
Posts: 319
Joined: Thu Sep 09, 2021 5:46 pm
Location: Alhambra's City

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 5:57 pm

This is one good one :)
PS I learned most of my stuff from copy/past and study...
{
:local Bytes ([/interface get pppoe-out1]->"rx-byte")
:local Type [:toarray "B,KB,MB,GB,TB,EB"]
:local Counter 0
:while ($Bytes > 1024) do={
	   :set $Bytes ($Bytes/1024)
	   :set $Counter ($Counter+1)
      }
:local Prefix [:pick $Type $Counter]
:put "$Bytes$Prefix"
}
Thank you very much @Jotne, you are very kind.
I am learning a lot from this great forum.

BR.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3291
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 7:46 pm

You are welcome.

If you need it as a function to do the you for multiple use. Here is a simplified "to human" version. Without the not needed ; every where ;)
:global human do={
	# Converts a number to SI-Prefix number
    :local INP [:tonum $1]
	:local Co 0
	:while ($INP > 1024) do={
		:set $INP ($INP/1024)
		:set $Co ($Co+1)
	}
	:return ($INP.[:pick [:toarray "B,KB,MB,GB,TB,PB,EB"] $Co])
}
How to use:
:put [$human 648007421264]
:put [$human ([/interface get ether1]->"rx-byte")]
Or data to variable:
{
:local Value ([$human ([/interface get ether1]->"rx-byte")])
:put $Value
}
PS Global variables/functions are deleted on reboot. So I you do use it in script, take care.
 
msatter
Forum Guru
Forum Guru
Posts: 2897
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 9:07 pm

Reread my earlier posting.
Sorry, I had not seen that I had edited the post
Then calling the function responds with the Eval code used by Mikrotik and is translation of your code to 'directly executable' code in ROS. If you put [ ] around the name of the function caller then it will return the calculated value instead of the Eval code
I have not understood anything!
(Not all of us are experts like you)

Thanks.
I am not an expert nor a programmer but, tried often enough to find out how scripting works in ROS. Eval code is the translation of the script code we humans write. You see that strange script appear if you don't put square brackets around this calling this function.

If you had put a parameter after it then the $1 would have transferred parameter into the function. The $1 is a reserved variable in a function.

The strange code called Eval, is coming from the word evaluate I assume:
;(evl / (evl /localname=$input;value=$1) / (evl /localname=$q) / (evl /localname=$r) / (evl /localname=$output) (evl /ifcondition=(< $input 1024);do
=;(evl (evl /setname=$output;value=(. $input  B)));else=;(evl / (evl /ifcondition=(< $input 1048576);do=;(evl (evl /setname=$q;value=(/ $input 1024)
) / (evl /setname=$r;value=(- $input (* $q 1024))) / (evl /setname=$r;value=(/ $r 102)) / (evl /setname=$output;value=(. $q . $r  KiB)));else=;(evl 
/ (evl /ifcondition=(< $input 1073741824);do=;(evl (evl /setname=$q;value=(/ $input 1048576)) / (evl /setname=$r;value=(- $input (* $q 1048576))) / 
(evl /setname=$r;value=(/ $r 104858)) / (evl /setname=$output;value=(. $q . $r  MiB)));else=;(evl / (evl /setname=$q;value=(/ $input 1073741824)) / 
(evl /setname=$r;value=(- $input (* $q 1073741824))) / (evl /setname=$r;value=(/ $r 107374182)) / (evl /setname=$output;value=(. $q . $r  GiB)))))))
) (evl /returnvalue=(evl (<%% $output (> $output)))))
Why does it display the Eval code?
By using :put $human you ask ROS to print the code of the function and it then displays then the code already converted to Eval.
By using :put [$human] you ask ROS to give you the result from the function.
By using :put :human 13 you ask ROS to give you the result from the function and the parameter 13 will be stored in $1 (special variable) inside the function.

When you store a function in Global then it is also stored converted to Eval code. As you can see underneath.
Eval.JPG
You do not have the required permissions to view the files attached to this post.
 
msatter
Forum Guru
Forum Guru
Posts: 2897
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 9:31 pm

So if I take the neat code by jotne and convert it into a function that could display any interface:
{
:local displayByte do={
:local Bytes ([/interface get $1]->"rx-byte")
:local Type [:toarray "B,KB,MB,GB,TB,PB,EB"]
:local Counter 0
:while ($Bytes > 1024) do={
	   :set $Bytes ($Bytes/1024)
	   :set $Counter ($Counter+1)
      }
:local Prefix [:pick $Type $Counter]
:return "$Bytes$Prefix"
}
:put [$displayByte pppoe-out1]
}
In this line you see the $1
:local Bytes ([/interface get $1]->"rx-byte")
which contains the parameter stated here
:put [$displayByte pppoe-out1]

Every extra parameter is placed in a extra reserved variable like, the second in $2 and the third in $3 etc.

:put [$displayByte pppoe-out1 rx-byte] then $2 will contain rx-byte

Code line is then: :local Bytes ([/interface get $1]->$2)

Now you can request any counter of any interface in one go.

And as Eval code it looks like this:
;(evl / (evl /localname=$Bytes;value=(-> (evl (evl /interface/getnumber=$1)) rx-byte)) (evl /localname=$Type;value=(evl (evl /toarrayvalue=B,KB,MB,GB,TB,PB,EB))) (evl /localname=$Counter;value=0) (evl /whilecondition=(> $Bytes 1024);do=;(evl / (evl /setname=$Bytes;value=(/ $Bytes 1024)) (evl /setname=$Counter;value=(+ $Counter 1)))) (evl /localname=$Prefix;value=(evl (evl /pickbegin=$Counter;counter=$Type))) (evl /returnvalue=(. $Bytes $Prefix)))
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3291
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 10:17 pm

I have not used time to study the eval code, so there I can not help you. :)
 
User avatar
diamuxin
Member
Member
Topic Author
Posts: 319
Joined: Thu Sep 09, 2021 5:46 pm
Location: Alhambra's City

Re: Function to convert B, KiB, MiB or GiB in a script

Thu Feb 03, 2022 11:50 pm

So if I take the neat code by jotne and convert it into a function that could display any interface:
{
:local displayByte do={
:local Bytes ([/interface get $1]->"rx-byte")
:local Type [:toarray "B,KB,MB,GB,TB,PB,EB"]
:local Counter 0
:while ($Bytes > 1024) do={
	   :set $Bytes ($Bytes/1024)
	   :set $Counter ($Counter+1)
      }
:local Prefix [:pick $Type $Counter]
:return "$Bytes$Prefix"
}
:put [$displayByte pppoe-out1]
}
In this line you see the $1
:local Bytes ([/interface get $1]->"rx-byte")
which contains the parameter stated here
:put [$displayByte pppoe-out1]

Every extra parameter is placed in a extra reserved variable like, the second in $2 and the third in $3 etc.

:put [$displayByte pppoe-out1 rx-byte] then $2 will contain rx-byte

Code line is then: :local Bytes ([/interface get $1]->$2)

Now you can request any counter of any interface in one go.

And as Eval code it looks like this:
;(evl / (evl /localname=$Bytes;value=(-> (evl (evl /interface/getnumber=$1)) rx-byte)) (evl /localname=$Type;value=(evl (evl /toarrayvalue=B,KB,MB,GB,TB,PB,EB))) (evl /localname=$Counter;value=0) (evl /whilecondition=(> $Bytes 1024);do=;(evl / (evl /setname=$Bytes;value=(/ $Bytes 1024)) (evl /setname=$Counter;value=(+ $Counter 1)))) (evl /localname=$Prefix;value=(evl (evl /pickbegin=$Counter;counter=$Type))) (evl /returnvalue=(. $Bytes $Prefix)))
OK, thanks.

BR.

Who is online

Users browsing this forum: No registered users and 21 guests