bandwidth tests script

We are using several mk links on the 5Ghz as point to point for our backbone
We are using almos 80% of allowed bandwith, but since this depends on the ambiental situation, we need the following:

from a mikrotik run a script that, lets say every 30 mins, is launching a
/tool bandwidth-test …

and i if the result is below 2Mb on one of the 2 direction take an action (for instance slow down the p2p queue).

can some one help me on this since I dont know how to read from a script the output of bandwidth tests.

thanks
Gianluca

Here you go:

/system script add name=bandtest source={
  :global i
  /tool bandwidth-test 1.1.1.1 \
    direction=transmit duration=4s protocol=tcp do={
        :set i $tx-current      
      }
     :set i ($i/1048576)
    :if ($i<2) do={/queue tree....}
  }

/system scheduler add name=check on-event=bandtest interval=30min disabled=no

in that case take CLI script editor (inside RouterOS) and edit script in there. Most of the syntax changes can be caught using that. F5 to refresh highlighting.