Run script on any mouse click

This is either an odd question or a bad idea or very obvious because I can’t find anything on the forum related to it. Is there a way to run a script on any mouse click in the client? I thought I could make a keystroke client script for it, but don’t see how to do that on just the left click.

I have a popup that I would like to close on any mouse click outside of it. I can use mouseexited() on the popup, but I don’t know if the user’s mouse will ever be in it.

Thanks, should have said - this is in 7.9

Unfortunately, no. Java Swing’s event model has input events consumed at the innermost component that listens for them, so there’s no reliable way to capture that click (it’ll be consumed by whatever is clicked). You might find what you need among the various lostFocus events.

Is there any way to run script for any mouse click inside a vision window with the latest release?My requirement is to track the number of clicks by each user.

Thanks