Daily Snippet

I needed a way to terminate an application from within another without using Apple Script or old Carbon stuff. I finally found this nifty solution:

if ([[NSWorkspace sharedWorkspace] respondsToSelector:@selector(runningApplications)]) {
for (NSRunningApplication *app in [[NSWorkspace sharedWorkspace] runningApplications])
if ([@"Suggestions" isEqualToString:[app localizedName]])
[app terminate];
}

  1. moapp posted this