Hello, anyone who can help me with my script. I want to add all the output total from my script.
/ip hotspot
:foreach i in=[user find where name!="admin" and name!="default-trial" and disabled=no and comment!=" "] do={
:local aUsrcomm [user get $i comment]
:local aUsrcomm [:toarray $aUsrcomm];
:local itotal [:tonum ($aUsrcomm->1)];
:log info $itotal;
}
Do you know what a variable is and what the + sign means?
Since I can not work on your machine and I do not have your settings, this is untested.
{
/ip hotspot user
:local tmp “”
:local tot 0
:foreach i in=[find where name!=“admin” and name!=“default-trial” and disabled=no and comment!=" "] do={
:set tmp [:toarray [get $i comment] ]
:set tot ($tot + [:tonum ($tmp->1) ] )
}