How to Trigger a Macro When a File Opens?

Hi - Is it possible to trigger a macro whenever a file opens?

Specifically I'd like to run a macro whenever a file is opened in Apple Numbers. Is this possible?

Any help is much appreciated!


Directly, I don't think so.
Indirectly, yes. You can perform it a number (pun) of ways.

If you want it to trigger off of any file, opened in Numbers, it would just be on Numbers Activation or Launch. Choose wisely because if you perform it on Activation, it will run every time you leave and come back to the application. You can use a counter to minimize this but that's another rabbit hole.

If you want it to open a specific file type (.numbers or .xls), you can do it like this:


If it's a specific .numbers document, you can perform it like this:

These should get you started but keep in mind that people perform these functions in many different and better ways than I do.

Good Luck and I hope this helps.



You could probably do this with launchd, but it's likely to be more effort than you'd want to put in.


Incredibly helpful - thanks KC!