Re: Application Activation Problem
Re: Application Activation Problem
- Subject: Re: Application Activation Problem
- From: Kyle Sluder <email@hidden>
- Date: Fri, 13 May 2016 09:59:02 -0500
On Fri, May 13, 2016, at 04:46 AM, Dave wrote:
> Hi All,
>
> I’m using:
>
> [myRunningApp activateWithOptions:(NSApplicationActivateAllWindows |
> NSApplicationActivateIgnoringOtherApps)];
>
> To activate an Application. Is there any way to tell when the Application
> is actually active? I have the need to cycle through an Array of App
> Bundle IDs and make each Application Active, one after the other, leaving
> the last one in the list as the Active App.
>
> If I do this in a tight loop then it seems to just activate the last on
> in the Array without activating the preceding apps. I tried adding a
> delay between each Activation call, and although this sort of works, it
> still out an App once in a while. I was thinking if there was something I
> could monitor to make sure the App has activated and is stable before
> sending the next Activate.
>
> Any ideas or suggestions greatly appreciated.
Activation is an inherently asynchronous and failable action. After all,
what if two apps send -activateWithOptions: simultaneously?
You might consider subscribing to
NSWorkspaceDidActivateApplicationNotification and cycling to the next
app in the list upon receipt, but the best you can do is best-effort.
--Kyle
>
> All the Best
> Dave
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden