Detect text and doble click

I need a program that constantly detects a “notification” in the form of on-screen text and performs a double click at the current cursor position when it finds a match. However, it should only perform a double click once, as the notification remains on the screen for about 20 seconds. Once the notification disappears from the screen, I want the program to continue detecting and performing the action continuously.
Can someone help me? I’ve tried it with AI but I keep getting errors.