How to Listen For an Application Launch Event on Mac OS X
-
16-10-2019 - |
Question
I wrote an AppleScript to mount a bundled sparse disk image. I want this script to be executed exactly when Time Machine launches.
I can check if Time Machine is running with on idle
statement,
on idle
....
return <interval>
end idle
but I'm pretty sure, it isn't a robust way to do that.
IMO making an event trigger for Application Launch
event would be a better approach.
I appreciate if someone can help me.
Solution
You can use a LaunchAgent (see Lingon) to perform an action when a file is modified. Time Machine has some file somewhere that it modifies each time it starts.
Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange