trigger action on opening of file type

Hi Folks=

can someone point me in the right direction? I need to trigger an action whenever an indesign file is opened.

I’m guessing I’d need to have the script running, and then either trigger it through a shell script or UI scripting. Any pointers?