script that search foe a user in hotspot

Hello,
I want to make a script that notify my whenever there is a user call “david” in the Hotspot-Users
I have try something like this
if ([:tobool[/ip hotspot user get [find name=david]] = true]) do={/system scripts run yes} else={/system scripts run no}

what did I do wrong?

thanks for the help,

hello david.

try this script


foreach i in=[ip hotspot user find ] do={
local user [ip hotspot user get value-name=name $i]
local name david
if ($user = $name ) do={beep length=3}
}

thanks - it’s working almost …
When I try to add an else section it’s doesn’t give me

foreach i in=[ip hotspot user find ] do={
local user [ip hotspot user get value-name=name $i]
local name ronen
if ($user = $name ) do={beep length=3};
else={beep length=1};
};

why is it?

foreach i in=[ip hotspot user find ] do={
local user [ip hotspot user get value-name=name $i]
local name ronen
if ($user = $name ) do={beep length=3} else={beep length=1};
}

Thanks a lot!

I have change 1 thing and now it’s not good
when I run this script I get the 2 messages if there is a user called david
and if not I get the "Not good " message

???


foreach i in=[ip hotspot user find ] do={
local user [ip hotspot user get value-name=name $i]
local name david
if ($user = $name ) do={/log warning "hotspot user O.K"} else={/log warning "Not Good"};
}

thanks ,

Faster script

:if ( [/ip hotspot user find name="david"] !="") do={ 
   :log warning "hotspot user O.K";
} else={
   :log warning "Not Good";
}

much smaller ,
thanks !