I'm modernizing some code that's a nasty pastiche of ProcessSerialNumber and 
LSLaunchXXX and CFBundleXXX. Having found that a certain app is not running, I 
need to launch it and get some info on it. But here's the problem:

[[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier: @"..." options: 
...]

launches the app just fine, but then:

[[NSWorkspace sharedWorkspace] runningApplications]

does not list it, even though it *is* running (and processing events)

It is as though the runningApplications method returns a cached list which is 
only updated when events are processed, thus I won't see the newly-launched app 
until the next pass through the runloop, thus cannot launch an app and 
immediately see it.

So, is there any way to get an NSRunningApplication instance for an app 
immediately after launching it, without resorting to some vile nastiness like 
using an NSTimer to delay the second half of what I'm doing until a later pass 
through the runloop??? It seems like a bad design that there's no (obvious) way 
to get info on an app that I just launched--to me, the obvious thing would be 
for launchAppWithBundleIdentifier to return an NSRunningApplication* or nil, 
instead of BOOL...

-- 
Scott Ribe
[email protected]
http://www.elevated-dev.com/
(303) 722-0567 voice





_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to