mode-button-scheduler 630 Bytes
Newer Older
1
#!rsc
2
# RouterOS script: mode-button-scheduler
3
# Copyright (c) 2018-2019 Christian Hesse <mail@eworm.de>
4 5 6
#
# act on multiple mode-botton presses from scheduler

7
:global ModeButton;
8

9 10 11
:local Count ($ModeButton->"count");
:local Code ($ModeButton->[ :tostr $Count ]);
:local Parsed [ :parse $Code ];
12

13
:set ($ModeButton->"count") 0;
14 15
/ system scheduler remove mode-button-scheduler;

16
:log info ("Acting on " . $Count . " mode-button presses: " . $Code);
17 18 19 20 21 22 23 24 25 26

:if ([ / system routerboard settings get silent-boot ] = false) do={
  :for I from=1 to=$Count do={
    :beep length=200ms;
    :delay 200ms;
  }
} else={
  :delay 1s;
}

27
$Parsed;