LEDtoggle, simple script to toggle user led on/off

  1. If work, is correct and is not too much complicated.
  2. See my example.
  3. Can be one-line command if accepts true/false (boolean) instead of on/off…
  4. Missing a chech if the leds group exist. On my example I add it if is missing (but I do not check hardware if have or not the led)

If is something that at the end must power off or on the wifi and user-led show the status…
http://forum.mikrotik.com/t/wi-fi-on-off-switch/103825/17


This script invert status and create user-led if not exist (do not check if hardware have or not the led):

/system leds
:local uledid [find where leds=[:toarray "user-led"]]
:if ([:len $uledid] < 1) do={
    add leds=[:toarray "user-led"] type="on"
} else={
    :if ([get $uledid type] = "off") do={
        set $uledid type="on"
    } else={
        set $uledid type="off"
    }
}