Running processes

This requires System Events beta to work: It returns a list of running “User” processes in 10.2 and up. This will leave out all of the “background” system processes. From the AppleScript Users List.

OS version: OS X

tell application "System Events"
    tell process "Dock" to set dockStuff to title of every UI element
    set runningApps to {}
    set procs to the title of application processes
    repeat with curApp in dockStuff
        if curApp is in procs then
            set runningApps to runningApps & curApp
         end if
    end repeat 
end tell

Nice, but this script will find apps that are running yet hidden from the dock:

tell application "System Events"
	set applist to {}
	set apps to get application processes
	repeat with a in apps
		if not background only of a then
			set end of applist to (displayed name of a)
		end if
	end repeat
	applist
end tell

Model: PowerMac 2 x G5 2.5ghz
AppleScript: 1.10.3
Browser: Safari 416.12
Operating System: Mac OS X (10.4)

Good stuff!

I like your better … :slight_smile:

I see top posting has even spread to these forums now. :frowning:

goron’s script can be reduced to:

tell application "System Events"
	set applist to displayed name of every application process where it is not background only
end tell

This too requires a fairly recent version of System Events.

That’s how we learn :slight_smile:

Of all three snippets of code, only Ray’s compiled for me. :confused:

Model: G4 Tower 1GHz
Browser: Safari 312.3.1
Operating System: Mac OS X (10.3.9)

:frowning: Maybe because you’re still on 10.3?

I guess I was just assuming this to be true:

And the fact that no one else mentioned 10.4 specifically when posting other code. But, I’ve now tested it on a 10.4 machine and all of them compile. Excellent.

Just a note on Ray’s original code:

Running on 10.3.9 it doesn’t recognize Adobe Illustrator 10.0.3
The title of Illustrator’s application process (Illustrator) is different than its name on the Dock (Adobe Illustrator 10).

The other code snips run as expected on 10.4.2, listing apps correctly.

That’s true of several other applications as well. QuickSilver shows up really strange, for example.