Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

yongren

macrumors regular
Original poster
Jan 19, 2011
117
0
Hi all,

Sorry for not-so-descriptive thread title. I didn't really know what to put there.

What would be the best way to set up automated tasks in this form?

When _____ happens, do _____.




I've read a little about Automator and AppleScript, but it seems like they are more for setting up specific series of actions that you must then run manually or schedule to run at a certain time.

What I want is a little different... I want to automate it where certain actions automatically trigger certain other actions.

like,

When [application A] is started, also start [application B].

or

When the last window of [application C] is closed, quit [application C].


Is this possible?

I've done almost no programming, if that isn't obvious. Sorry if it's a stupid question or if it's in the wrong place.

Thanks for your time.
 
For that to work, you'd have to have a notification system built into the OS that watches for all these events constantly and then triggers your script when they happen. With a few exceptions (such as when a file is added to a folder, or a storage device is mounted), this isn't the case. You might be able to run a script which constantly polls certain functions like process monitor to watch for a certain app being launched, and then takes some action based on that. And some applications which are Apple-scriptable will have some hooks to get certain info (for example, you could poll to see if any windows are still open). So certain things you ask are possible, but it might be pretty inefficient and not that reliable to do them.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.