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!

@adamg

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:

Example,

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.

KC

2 Likes

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

https://medium.com/swlh/how-to-use-launchd-to-run-services-in-macos-b972ed1e352

-Chris

Incredibly helpful - thanks KC!