Simple script with mangle

Hello. Pls help me with my problem
Did the simple script

:local commentName “Net”
:local i [/ip firewall mangle get value-name=disable number=[find comment=$commentName]];
:if (i=true) do={
/ip firewall mangle enable [/ip firewall mangle find comment=$commentName];
}

But it works only to enable
If i want to disable this rule change disable to enable and in last string enable to disable - but doesnt work
in what is the mistake?

There is not command to disable rule in your script, that is the main reason :slight_smile:

This script for disable rule - but doesnt work

:local commentName “Net”
:local i [/ip firewall mangle get value-name=enable number=[find comment=$commentName]];
:if (i=true) do={
/ip firewall mangle disable [/ip firewall mangle find comment=$commentName];
}

Parameter “enable” does not exist.

List of valid parameters can be found here
http://wiki.mikrotik.com/wiki/Manual:IP/Firewall/Mangle#Properties

Hm, cannot find solution. Took the help from this topic http://forum.mikrotik.com/t/ip-firewall-mangle-dont-works-as-expected-in-script/42363/1

The property you’re looking for is “disabled”. Notice the “d” in the end.

You don’t need to do an “if” BTW, just use an appropriate “find” in the disable/enable command, i.e. to disable:

:local commentName "Net"
/ip firewall mangle disable [/ip firewall mangle find disabled=no && comment=$commentName];

or to enable

:local commentName "Net"
/ip firewall mangle enable [/ip firewall mangle find disabled=yes && comment=$commentName];