tags:

views:

32

answers:

2

Launching a program so that it opens in center of the launching application.

Platform: Mac Launching mechanism: a c++ program launches using system()

Currently I observe the program launched pushes it to left most part of the screen.

A: 

If you're using system, there's really nothing you can do, since you've implicitly delegated everything about the process except its startup args to the OS. There may be ways to accomplish this using other OSX-specific APIs, but not with the parameters you've outlined here.

JSBangs
+1  A: 

Launching a program so that it opens in center of the launching application.

On Mac OS X systems, programs don't launch into a specific area of the screen. When they launch, they become the "front" application, and take over the menubar area with their own menus. They may choose to open a window after they have opened, or not.

Find out if the program in question accepts apple events / applescript commands. If so, you may be able to ask the program to position a window in a particular location.

Also, if you still have to use system, you can send apple events with the osascript command.

Seth