diff --git a/doc/mode-button.md b/doc/mode-button.md index 547396d5..68363baa 100644 --- a/doc/mode-button.md +++ b/doc/mode-button.md @@ -4,7 +4,7 @@ Mode button with multiple presses [![GitHub stars](https://img.shields.io/github/stars/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=red)](https://github.com/eworm-de/routeros-scripts/stargazers) [![GitHub forks](https://img.shields.io/github/forks/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=green)](https://github.com/eworm-de/routeros-scripts/network) [![GitHub watchers](https://img.shields.io/github/watchers/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=blue)](https://github.com/eworm-de/routeros-scripts/watchers) -[![required RouterOS version](https://img.shields.io/badge/RouterOS-7.21-yellow?style=flat)](https://mikrotik.com/download/changelogs/) +[![required RouterOS version](https://img.shields.io/badge/RouterOS-7.22-yellow?style=flat)](https://mikrotik.com/download/changelogs/) [![Telegram group @routeros_scripts](https://img.shields.io/badge/Telegram-%40routeros__scripts-%2326A5E4?logo=telegram&style=flat)](https://t.me/routeros_scripts) [![donate with PayPal](https://img.shields.io/badge/Like_it%3F-Donate!-orange?logo=githubsponsors&logoColor=orange&style=flat)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J) diff --git a/mode-button-scheduler.rsc b/mode-button-scheduler.rsc index a7bedfb6..65d56faa 100644 --- a/mode-button-scheduler.rsc +++ b/mode-button-scheduler.rsc @@ -3,13 +3,12 @@ # Copyright (c) 2018-2026 Christian Hesse # https://rsc.eworm.de/COPYING.md # -# requires RouterOS, version=7.21 +# requires RouterOS, version=7.22 # requires device-mode, scheduler # # act on multiple mode and reset button presses # https://rsc.eworm.de/doc/mode-button.md -:local ExitOK false; :onerror Err { :global GlobalConfigReady; :global GlobalFunctionsReady; :retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \ @@ -39,8 +38,7 @@ :if ([ :len $Scheduler ] = 0) do={ $LogPrint error $ScriptName ("Scheduler does not exist."); - :set ExitOK true; - :error false; + :exit; } :local Count ([ :deserialize from=json [ /system/scheduler/get $Scheduler comment ] ]->"count"); @@ -50,15 +48,13 @@ :if ([ :len $Code ] = 0) do={ $LogPrint info $ScriptName ("No action defined for " . $Count . " mode-button presses."); - :set ExitOK true; - :error false; + :exit; } :if ([ $ValidateSyntax $Code ] = false) do={ $LogPrint warning $ScriptName \ ("The code for " . $Count . " mode-button presses failed syntax validation!"); - :set ExitOK true; - :error false; + :exit; } $LogPrint info $ScriptName ("Acting on " . $Count . " mode-button presses: " . $Code); @@ -80,5 +76,5 @@ ("The code for " . $Count . " mode-button presses failed with runtime error: " . $Err); } } do={ - :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; + :global ExitOnError; $ExitOnError [ :jobname ] $Err; } diff --git a/mode-button.rsc b/mode-button.rsc index 364fa33f..0870930b 100644 --- a/mode-button.rsc +++ b/mode-button.rsc @@ -3,7 +3,7 @@ # Copyright (c) 2018-2026 Christian Hesse # https://rsc.eworm.de/COPYING.md # -# requires RouterOS, version=7.21 +# requires RouterOS, version=7.22 # requires device-mode, scheduler # # act on multiple mode and reset button presses