Upgrade v 3.10 to 3.24 = script problem

Hi @ll
please see and check this script

:local signal
:local body
:local name

:set name ("SIGNAL na " . [/system identity get name])

:foreach i in=[/int wir reg find ap=no] do={
  :set signal [/int wir reg get $i signal-strength];
  :set signal [ :pick $signal 0 [:find $signal "dBm"]]
  :if ($signal < -69) do={
       :log w ("Signal alert: " . [/int wir reg get $i signal-strength] . " - MAC: " . [/int wir reg get $i mac]  . " - coment: " . [/int wir reg get $i comment] )
       :set body ("SIGNAL alert " . [/int wir reg get $i signal-strength]  . " - MAC: " . [/int wir reg get $i mac]  . " - coment " . [/int wir reg get $i comment] . " wrong. " )
      /tool e-mail send to=cermak@czechdata.cz subject=$name body=$body
  }
}

Thanks for help.

You cannot extract the value of the comment field directly from /int wir reg. You have to get it from /int wir access.

Try this:

{
:local signal
:local body
:local sysname
:local macid

:set sysname ("SIGNAL na " . [/system identity get name])

:foreach i in=[/int wir reg find ap=no] do={
:set signal [/int wir reg get $i signal-strength];
:set signal [ :pick $signal 0 [find $signal "dBm"];
:set macid [/int wir reg get $i mac]]
:if ($signal < -69) do={
:log info ("Signal alert: " . [/int wir reg get $i signal-strength] . " - MAC: " . $macid  . " - comment: " .  [/int wir access get [find mac-address=$macid] comment])
:set body ("SIGNAL alert " . [/int wir reg get $i signal-strength]  . " - MAC: " . $macid  . " - comment: " .  [/int wir access get [find mac-address=$macid] comment] . " wrong. " )
/tool e-mail send to=cermak@czechdata.cz subject=$sysname body=$body
}
}
}

Mind you, the script will partially fail and return “interrupted no such item” if there is a registered client that meets the scripts requirement but does not have any value in the comment field.

To solve this problem, just remove the comment section of the script.

:frowning:

Script always not work even after remove comment