Trigger script from Kid-Control dynamic firewall rule

Hi,

I have an issue with the Kid-Control feature. This is a great tool, but it does not kill active connections. Kid can play with PC without limits if he does not close the game.

I have written the script, and it is working, but I cannot understand how to trigger it automatically.
Kid-control creates the rule automatically and I cannot involve in it. The rule looks like this:
Screenshot 2024-02-02 205024.png
The script:

#searching rule with comment "AidoPC, kid-control". This rule creates by kid-control
:foreach r in=[/ip firewall filter find where comment="AidoPC, kid-control"] do={
#searching the PC name AidoPC
 :foreach ENTRY in=[/ip firewall address-list find list="AidoPC"] do={
  :local IP [/ip firewall address-list get number=$ENTRY address ]; 
#Searching IP with all ports
   :foreach CONN in=[/ip firewall connection find src-address~"^$IP:"] do={
#killing active sessions
    /ip firewall connection remove $CONN;
  }
 }
}

How to trigger the script automatically when the kid-control enables dynamic rule to block the device?

Not sure the purpose behind the first for loop, you never use the variable even.

It seems to me, if I’m understanding correctly what you want it is:

If there is a kid-control rule, find the ip address(s) involved in the rule(s) remove the connections associated with those rule(s)

What is the kid rule? Does it just block all traffic from that ip?

If so:
Replace the first foreach loop with an if statement . So if there’s any kid rule it checks the ip(s) and removes the connection(s) . Then run it on scheduler to trigger on an interval.

I appreciate your recommendations. I added my script to the schedule and it works great.