Q:  How can I make an application launch and become the active application?

Q:  Why don't I get windowDidBecomeKey and windowDidBecomeMain messages when my application is launched? 

A:  Normally, applications should not need to ever worry about activating themselves. When the Workspace launches an application it deactivates itself, and then it activates the application as it completes the launch.  It sends the application the message activateSelf:NO and this results in the behavior where the application becomes active if the user waits for it, but it does not interrupt the user by becoming active if the user began using a different application in the meantime.

The reason for this is the need for predictable consistent behavior in a multitasking system.  Imagine you double-click an Edit file.  Edit begins to launch.  You activate Shell and start typing.  When Edit finishes launching, do you want it to take over as the active application and suddenly start grabbing the keystrokes you intended for Shell?  Probably not.  Edit will only become the active application if you wait for it to launch and don't activate another application.

A:  You also do not receive windowDidBecomeKey and windowDidBecomeMain messages until your application becomes active.  The key and main window of an application have no meaning when the application is inactive. 

QA15

Valid for 2.0, 3.0