# Recent programs list

**URL:** <https://forum.xojo.com/t/recent-programs-list/17573>\
**Category:** macOS\
**Created:** [June 28, 2014, 1:26pm UTC](https://forum.xojo.com/t/recent-programs-list/17573 "2014-06-28T13:26:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [June 28, 2014, 1:26pm UTC](https://forum.xojo.com/t/recent-programs-list/17573/1 "2014-06-28T13:26:45Z")

</div>

Is there any way by program, declare or plugin, to get a list of the recent applications which have been run on Mac OS X ?

The idea is to display a list of the 10 last run apps which most may not be running.

I can monitor regularly running apps through a shell to `ps -A` and build the list from there, but if that was already done by the system, it would be great. Especially on first run of my app, which by hypothesis will not have the list if I build it from ps.

Any idea will be greatly appreciated.

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![Eli\_Ott](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/5f8ce5/32.png) [@Eli\_Ott](https://forum.xojo.com/u/Eli_Ott)\
**Post date:** [June 28, 2014, 1:40pm UTC](https://forum.xojo.com/t/recent-programs-list/17573/2 "2014-06-28T13:40:38Z")

</div>

Have a look at the file com.apple.recentitems.plist in the user’s Library folder.

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [June 28, 2014, 1:43pm UTC](https://forum.xojo.com/t/recent-programs-list/17573/3 "2014-06-28T13:43:55Z")

</div>

> [@105494:@Eli Ott](#):
>
> Have a look at the file com.apple.recentitems.plist in the user’s Library folder.

Thank you. Indeed, the Recent Applications dictionnary is exactly what I meant.

Now as it is in the user library, I probably won’t be allowed to fetch the plist with a sandboxed app ☹

I will probably have to settle with opening with a preset “standard” list and update it with ps later.

---

<div class="post-metadata">

**Author:** ![Joe\_Ranieri](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@Joe\_Ranieri](https://forum.xojo.com/u/Joe_Ranieri)\
**Post date:** [June 28, 2014, 3:14pm UTC](https://forum.xojo.com/t/recent-programs-list/17573/4 "2014-06-28T15:14:17Z")

</div>

> [@105494:@Eli Ott](#):
>
> Have a look at the file com.apple.recentitems.plist in the user’s Library folder.

This is an implementation detail. There is a public API for this, and the process is roughly:

- invoke `LSSharedFileListCreate`, passing in `kLSSharedFileListRecentApplicationItems`
- invoke `LSSharedFileListCopySnapshot` with that shared file list
- invoke `CFRelease` on the shared file list
- process the CFArray and do whatever you want with it
- remember to release the CFArray when done

---

<div class="post-metadata">

**Author:** ![Paulo\_Vargas](https://forum.xojo.com/user_avatar/forum.xojo.com/paulo_vargas/32/232_2.png) [@Paulo\_Vargas](https://forum.xojo.com/u/Paulo_Vargas)\
**Post date:** [June 29, 2014, 12:15am UTC](https://forum.xojo.com/t/recent-programs-list/17573/5 "2014-06-29T00:15:27Z")

</div>

I believe that you can make a program that would have a Listbox and a timer in mode = 2 would record through an applescript launched the programs and would list in the listbox, I do not know exactly what code Applescript but I’m pretty sure it would work, however, this program would have to be running in background all the time on the machine, so it could be launched at startup items …

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [June 29, 2014, 10:01am UTC](https://forum.xojo.com/t/recent-programs-list/17573/6 "2014-06-29T10:01:51Z")

</div>

[quote=105517:@Joe Ranieri]This is an implementation detail. There is a public API for this, and the process is roughly:

- invoke `LSSharedFileListCreate`, passing in `kLSSharedFileListRecentApplicationItems`
- invoke `LSSharedFileListCopySnapshot` with that shared file list
- invoke `CFRelease` on the shared file list
- process the CFArray and do whatever you want with it
- remember to release the CFArray when done[/quote]

Thanks you Joe. Now I will need some time to create the proper declares 😉

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [June 29, 2014, 10:04am UTC](https://forum.xojo.com/t/recent-programs-list/17573/7 "2014-06-29T10:04:06Z")

</div>

> [@105625:@Paulo Vargas](#):
>
> I believe that you can make a program that would have a Listbox and a timer in mode = 2 would record through an applescript launched the programs and would list in the listbox, I do not know exactly what code Applescript but I’m pretty sure it would work, however, this program would have to be running in background all the time on the machine, so it could be launched at startup items …

Exactly what I had in mind, although instead of AppleScript I would use simply a shell to see the running processes, as I described above. Thank you Paulo.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:17pm UTC](https://forum.xojo.com/t/recent-programs-list/17573/8 "2020-10-29T17:17:49Z")

</div>


