Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Applescript - list all running applications

Tags:

applescript

How can i get a list of running applications in the same order they appear when doing ⌘ + ⇥ from within an applescript?

I.e. if I use TextEdit, then Preview, then iCal, the order is

iCal, Preview, TextEdit

This question which asked if there was an API that could produce this list provided this answer:

$ cd /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework

$ nm LaunchServices | grep __LSCopyApplicationArrayInFrontToBackOrder

But how can I access this list from within an applescript?

like image 597
user247298 Avatar asked Oct 13 '09 19:10

user247298


1 Answers

Not sure as how to order them But this lists applications that are not background only

tell application "System Events" to get the name of every process whose background only is false
like image 65
ikoderuk Avatar answered Nov 08 '22 09:11

ikoderuk