- If work, is correct and is not too much complicated.
- See my example.
- Can be one-line command if accepts true/false (boolean) instead of on/off…
- 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"
}
}