The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Get A List Of Processes Running On A Mac With JavaScript

TODO: Pull subtitle into page object
Code
#!/usr/bin/env osascript -l JavaScript 

const processList = Application("System Events").applicationProcesses;
const appCount = processList.length;

for (let appIndex = 0; appIndex < appCount; appIndex ++) {
  console.log(processList[appIndex].name());
}
Results
loginwindow
ViewBridgeAuxiliary
SystemUIServer
Dock
ControlCenter
ViewBridgeAuxiliary
AppSSOAgent
QuickLookUIService
etc...

Notes

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Get A List Of Processes Running On A Mac With JavaScript

This script produces a list of the foreground and
background processes running on a mac

-- code
-- osascript

#!/usr/bin/env osascript -l JavaScript 

const processList = Application("System Events").applicationProcesses;
const appCount = processList.length;

for (let appIndex = 0; appIndex < appCount; appIndex ++) {
  console.log(processList[appIndex].name());
}

-- results/

loginwindow
ViewBridgeAuxiliary
SystemUIServer
Dock
ControlCenter
ViewBridgeAuxiliary
AppSSOAgent
QuickLookUIService
etc...

-- /results


-- notes

- This script is a JavaScript For Automation
OSA script

- It takes several seconds to run on my machine

- You can make it executable and run it as a file
or call it from the command line with:

`osascript -l JavaScript FILENAME.js``

-- todo

[] Link the post that shows how to do
just the foreground apps

-- categories
-- OSA Script 
-- JavaScript 
-- Mac 

-- metadata
-- date: 2023-03-03 21:06:30
-- id: 2mwujujn
-- status: published 
-- type: post
-- site: aws