• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Launch another app without losing focus
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Launch another app without losing focus


  • Subject: Re: Launch another app without losing focus
  • From: Mike Kobb <email@hidden>
  • Date: Tue, 13 Jun 2006 16:35:46 -0700

To answer my own question, NSTask (as suggested by another list member) does the trick. My "helper" launches without affecting my window activation. You *do* have to make sure that it's not already running, or it will launch a second copy of whatever you're launching! Thanks for your help.

--Mike

On Jun 13, 2006, at 4:02 PM, Mike Kobb wrote:

This does seem to work with respect to the window activation problem, but it has two other problems:

1) I don't have any control over which binary is launched (because there's no path). If somebody happened to have two copies on their machine of the "helper" (which would be unusual), then it may launch the wrong one.

2) It seems perfectly happy to launch more than one copy! I definitely do not want that. I am definitely not passing NSWorkspaceLaunchNewInstance, so I'm puzzled as to why it would be doing this, unless it's sequentially launching every copy of the helper that I happen to have on my system...

Very frustrating.

I'd appreciate any further thoughts.

Best,
--Mike


On Jun 13, 2006, at 6:58 AM, Ryan Britton wrote:

Is there any reason you can't use the launch option NSWorkspaceLaunchWithoutActivation?

Combine it with this: http://developer.apple.com/documentation/ Cocoa/Reference/ApplicationKit/Classes/NSWorkspace_Class/Reference/ Reference.html#//apple_ref/occ/instm/NSWorkspace/ launchAppWithBundleIdentifier:options:additionalEventParamDescriptor: launchIdentifier:


On Jun 12, 2006, at 11:13 PM, Mike Kobb wrote:

Greetings,

I'm working on a little project that is a System Preferences pane which controls a server.

One of the things the pane may do is to launch a faceless background "helper" application. I'm doing this like so:

[[NSWorkspace sharedWorkspace] launchApplication:helperPath];

helperPath is the path to my helper app.

This works great, but when I do this, the System Preferences main window becomes inactive, and I have to click the window to have it become active again.

Is there a different way to launch an app like this so that I don't lose activation?

Thanks!
--Mike


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Launch another app without losing focus (From: Mike Kobb <email@hidden>)
 >Re: Launch another app without losing focus (From: Ryan Britton <email@hidden>)
 >Re: Launch another app without losing focus (From: Mike Kobb <email@hidden>)

  • Prev by Date: RE: launch agent questions
  • Next by Date: Re: No crashlog & my application is leaving me :-(
  • Previous by thread: Re: Launch another app without losing focus
  • Next by thread: Re: Launch another app without losing focus
  • Index(es):
    • Date
    • Thread