#skript CheckSpeed

#nacti_hodnoty
/interface wireless registration-table print stats

#uloz_do_sn_rychlost_prenosu_klienta_0
:global sn [interface wireless registration-table get value-name=tx-rate  0];

#rozdeleni_podle_rychlosti
#plna
if ($sn="54Mbps" or $sn="48Mbps") do={

if ([:len [/file find name=stavM.txt]] > 0) do={/file remove stavM.txt};
if ([:len [/file find name=stavL.txt]] > 0) do={/file remove stavL.txt};
if ([:len [/file find name=stavQ.txt]] > 0) do={/file remove stavQ.txt};

if ([:len [/file find name=stavF.txt]] > 0) do={} else={/file print file=stavF.txt; /system script run FullSpeed};

};

#polovicni
if ($sn="36Mbps" or $sn="24Mbps") do={

if ([:len [/file find name=stavF.txt]] > 0) do={/file remove stavF.txt};
if ([:len [/file find name=stavL.txt]] > 0) do={/file remove stavL.txt};
if ([:len [/file find name=stavQ.txt]] > 0) do={/file remove stavQ.txt};

if ([:len [/file find name=stavM.txt]] > 0) do={} else={/file print file=stavM.txt; /system script run HalfSpeed};

};

#ctvrtinova
if ($sn="18Mbps" or $sn="12Mbps" or $sn="11Mbps" or $sn="9Mbps") do={

if ([:len [/file find name=stavF.txt]] > 0) do={/file remove stavF.txt};
if ([:len [/file find name=stavL.txt]] > 0) do={/file remove stavL.txt};
if ([:len [/file find name=stavM.txt]] > 0) do={/file remove stavM.txt};

if ([:len [/file find name=stavQ.txt]] > 0) do={} else={/file print file=stavQ.txt; /system script run QuarterSpeed};

};

#nizka
if ($sn="6Mbps" or $sn="5.5Mbps" or $sn="2Mbps" or $sn="1Mbps") do={

if ([:len [/file find name=stavF.txt]] > 0) do={/file remove stavF.txt};
if ([:len [/file find name=stavM.txt]] > 0) do={/file remove stavM.txt};
if ([:len [/file find name=stavQ.txt]] > 0) do={/file remove stavQ.txt};

if ([:len [/file find name=stavL.txt]] > 0) do={} else={/file print file=stavL.txt; /system script run SlowSpeed};

};



