I'm trying to launch another application using NSTask
NSArray* argArray = [NSArray arrayWithObjects:fileName, nil];
NSTask* task = [NSTask launchedTaskWithLaunchPath:appName arguments:argArray];
while this works the main gui window doesn't come to front.
when repeatedly calling with different fileName the new file does get loaded in the app even though only 1 instance of the app is running
any poiners? I did try SetFrontProcess
but seems to have no effect even after introducing a delay
I did look into NSRunningApplication but it seems it is not available on 10.5 whereas I need a solution for both 10.5 and 10.6
Don't use
NSTask
to launch applications. Use NSWorkspace, which has several methods (e.g.-launchApplication:
) to launch and activate an application.