Run script when application launches

Hi there

Anyone know how one might trigger a script when an application launches, using Launchd or some other daemon running under Mac OS X? I don’t want to have a script running permanently just to check if an app launches.


Not directly. The options for a launchd job are time related or when a file modified or an item placed into a folder. At least from the basic lingon interface. There could be more triggers, but those have always suited me.

What you could do though is make a applescript app that launches the application you want to watch for itself and then perform what ever the code is you wanted since you know the application is launching.


what’s about this workaround:

Create a script saved as application bundle.
Assign the original icon of the application to launch to the bundle.
Execute the things you want to do and then launch the real application

bwahaha, although you explained better than I did I beat ya too it :smiley:

Thanks for these. Both good ideas.

I have no control over the app launch time. So Stefan’s looks like the one to try for.

For the time being, I have got a Folder action work around running. It seems to do the trick. Not as elegant as Stefan’s solution. But until it breaks, think I will leave it at that.


  • applause * :slight_smile: