NSRunningApplication, return list of recently used applications?
Asked Answered
H

2

4

I'm trying to get a list of the most recently used applications. NSWorkspace returns a list of active applications and I can sort them on a few options using NSRunningApplication. see list below:

- launchDate
- finishedLaunching
- processIdentifier

I don't want the launch date but the most recent 'active' date (like the way cmd-tab sorts). Does anyone know the solution for this?

Heimer answered 8/6, 2010 at 7:48 Comment(0)
H
5

There is no documented way of doing this that I'm aware of, but I wrote exactly what you are asking for using private APIs: http://gist.github.com/163918

Also, see Getting the list of running applications ordered by last use for solutions that do not use private APIs.

Header answered 8/6, 2010 at 21:38 Comment(1)
hi 0xced, thanks for your answer, i will look into both solutions, it looks very promising!Heimer
C
0

You can look at this sample provided by Apple: http://developer.apple.com/library/mac/#samplecode/AppList/Introduction/Intro.html#//apple_ref/doc/uid/DTS40008859-Intro-DontLinkElementID_2

In this sample, they are using NSRunningApplications Class in order to get all the bundle data about running applications.

Canonist answered 25/11, 2011 at 18:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.