script that remove active hotspot user if the name is not in the Users anymore

Hi guys! I’m just a newbie at scripting. I was wondering how can I remove active hotspot user if they are already removed from the Users tab.

I have this script that automatically removes a user from Users tab

for x from=0 to=6 do={
    /ip hotspot user set [find comment=$x] comment=($x-1)
    delay 50ms
}
/ip hotspot user remove [find comment=-1]

I tried to do it this way

for x from=0 to=6 do={
    /ip hotspot user set [find comment=$x] comment=($x-1)
   /ip hotspot active set [find comment=$x] comment=($x-1)
    delay 50ms
}
/ip hotspot user remove [find comment=-1]
/ip hotspot active remove [find comment=-1]

Then I found out that comments in Active tab cannot be modified that way.
So when the user is an active one, they are not removed from the Active tab.

Any help? :smiley:

Thanks in advance!