mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
mode-button: RouterOS v7 path syntax
This commit is contained in:
parent
2f46495be1
commit
0e466c3b81
1 changed files with 7 additions and 7 deletions
14
mode-button
14
mode-button
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
:set ($ModeButton->"count") ($ModeButton->"count" + 1);
|
:set ($ModeButton->"count") ($ModeButton->"count" + 1);
|
||||||
|
|
||||||
:local Scheduler [ / system scheduler find where name="ModeButtonScheduler" ];
|
:local Scheduler [ /system/scheduler/find where name="ModeButtonScheduler" ];
|
||||||
|
|
||||||
:if ([ :len $Scheduler ] = 0) do={
|
:if ([ :len $Scheduler ] = 0) do={
|
||||||
$LogPrintExit2 info $0 ("Creating scheduler ModeButtonScheduler, counting presses...") false;
|
$LogPrintExit2 info $0 ("Creating scheduler ModeButtonScheduler, counting presses...") false;
|
||||||
|
@ -32,11 +32,11 @@
|
||||||
|
|
||||||
:global IfThenElse;
|
:global IfThenElse;
|
||||||
|
|
||||||
:local LED [ / system leds find where leds=$ModeButtonLED type~"^(on|off)\$" interface=[] ];
|
:local LED [ /system/leds/find where leds=$ModeButtonLED type~"^(on|off)\$" interface=[] ];
|
||||||
:if ([ :len $LED ] = 0) do={
|
:if ([ :len $LED ] = 0) do={
|
||||||
:return false;
|
:return false;
|
||||||
}
|
}
|
||||||
/ system leds set type=[ $IfThenElse ([ get $LED type ] = "on") "off" "on" ] $LED;
|
/system/leds/set type=[ $IfThenElse ([ get $LED type ] = "on") "off" "on" ] $LED;
|
||||||
}
|
}
|
||||||
|
|
||||||
:local Count ($ModeButton->"count");
|
:local Count ($ModeButton->"count");
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
:set ($ModeButton->"count") 0;
|
:set ($ModeButton->"count") 0;
|
||||||
:set ModeButtonScheduler;
|
:set ModeButtonScheduler;
|
||||||
/ system scheduler remove ModeButtonScheduler;
|
/system/scheduler/remove ModeButtonScheduler;
|
||||||
|
|
||||||
:if ([ :len $Code ] > 0) do={
|
:if ([ :len $Code ] > 0) do={
|
||||||
:if ([ $ValidateSyntax $Code ] = true) do={
|
:if ([ $ValidateSyntax $Code ] = true) do={
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
|
|
||||||
:for I from=1 to=$Count do={
|
:for I from=1 to=$Count do={
|
||||||
$LEDInvert;
|
$LEDInvert;
|
||||||
:if ([ / system routerboard settings get silent-boot ] = false) do={
|
:if ([ /system/routerboard/settings/get silent-boot ] = false) do={
|
||||||
:beep length=200ms;
|
:beep length=200ms;
|
||||||
}
|
}
|
||||||
:delay 200ms;
|
:delay 200ms;
|
||||||
|
@ -68,9 +68,9 @@
|
||||||
$LogPrintExit2 info $0 ("No action defined for " . $Count . " mode-button presses.") false;
|
$LogPrintExit2 info $0 ("No action defined for " . $Count . " mode-button presses.") false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/ system scheduler add name="ModeButtonScheduler" \
|
/system/scheduler/add name="ModeButtonScheduler" \
|
||||||
on-event=":global ModeButtonScheduler; \$ModeButtonScheduler;" interval=3s;
|
on-event=":global ModeButtonScheduler; \$ModeButtonScheduler;" interval=3s;
|
||||||
} else={
|
} else={
|
||||||
$LogPrintExit2 debug $0 ("Updating scheduler ModeButtonScheduler...") false;
|
$LogPrintExit2 debug $0 ("Updating scheduler ModeButtonScheduler...") false;
|
||||||
/ system scheduler set $Scheduler start-time=[ /system clock get time ];
|
/system/scheduler/set $Scheduler start-time=[ /system/clock/get time ];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue