On May 30, 2009, at 7:57 PM, Ammar Ibrahim wrote:

On Sun, May 31, 2009 at 3:27 AM, Kyle Sluder <kyle.slu...@gmail.com> wrote:

On Sat, May 30, 2009 at 5:20 PM, Ammar Ibrahim <ammar.ibra...@gmail.com >
wrote:
2- Is there a way to launch applications like iTunes from cocoa without
the
need to use AppleScript?

Look at the NSWorkspace documentation.  iTunes's bundle identifier is
com.apple.iTunes, but in general you can look at any app bundle's
Info.plist file to get its bundle identifier (the CFBundleIdentifier
key).


Thanks, I did and it did the trick. One question though, it seems the call returns before the app is launched, what's the best way to detect when the app is launched? I heard there's something called notification center or so.
Is there a way to view all notifications being sent on my Mac?

Which method are you using, specifically? If you use - launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier : and don't pass NSWorkspaceLaunchAsync among the options, it should launch synchronously.

Alternatively, you can observe the NSWorkspaceDidLaunchApplicationNotification notification to be notified asynchronously rather than blocking synchronously. See the Notification Programming guide for more info <http://developer.apple.com/documentation/Cocoa/Conceptual/Notifications/ >.

However, it's not always clear what it means for an app to be launched. Does it mean the process has been created? Does it mean the app icon has stopped bouncing in the Dock? Does it mean the app has finished processing all of the initial events and has reached an idle point? You should be clear in your mind about what you want and why you think you need to know.

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to