Discrepancy Between Running Apps Token and for Each Action or User Error?

Hey @peternlewis, I have a question regarding the “running applications” parameter in a for each action and the %Application%All% token, as they return different information.

Do they return different results by design? Or are they supposed to produce the same results? I ask because the for each action returns a significantly shorter list of running apps than does the %Application%All% token. I read through the wiki, and perhaps missed or misunderstood something.

I have attached a demo macro that will show the different results and the text output from the results of running it on my computer.

Text output (click to expand/collapse)

Running apps as listed in for each action (28)
/Applications/Keyboard Maestro.app
/Users/cdthomer/Applications/Keyboard Maestro Forum.app
/System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app
/System/Library/CoreServices/Finder.app
/Applications/WhatsApp.app
/Applications/Script Debugger.app
/Applications/Windows App.app
/System/Applications/Notes.app
/Applications/Microsoft Teams.app
/Applications/Google Chrome.app
/Applications/BBEdit.app
/System/Applications/Utilities/Terminal.app
/Applications/Microsoft Edge.app
/System/Applications/Reminders.app
/System/Applications/Calendar.app
/Users/cdthomer/Applications/Reddit.app
/System/Applications/Messages.app
/System/Applications/Mail.app
/Applications/Microsoft OneNote.app
/System/Applications/TextEdit.app
/Applications/Slack.app
/System/Applications/TV.app
/Applications/Hazel.app
/System/Applications/Photos.app
/System/Applications/Preview.app
/System/Applications/Shortcuts.app
/System/Applications/Maps.app
/System/Applications/Music.app

Running apps as listed in %Application%All% token (161)
Keyboard Maestro
Keyboard Maestro Forum
Alfred
Safari
Typinator
Finder
‎WhatsApp
UserNotificationCenter
Script Debugger
Windows App
Notes
Microsoft Teams
Google Chrome
BBEdit
Terminal
Microsoft Edge
Reminders
Calendar
Reddit
Messages
Mail
loginwindow
Microsoft OneNote
TextEdit
Slack
Dock
Ivanti Secure Access Client
TV
Hazel
Photos
Preview
Stream Deck
Shortcuts
Shortcuts
Jettison
Maps
CCC Dashboard
Bartender 5
iStat Menus Menubar
Music
Keyboard Maestro Engine
universalaccessd
WindowManager
SystemUIServer
CoreServicesUIAgent
Control Center
ViewBridgeAuxiliary
Wallpaper
AXVisualSupportAgent
QuickLookUIService (Finder)
talagent
Notification Center
Spotlight
Dock Extra
chronod
Rectangle
Caffeine
Mic Drop
Garmin Express Service
Shortcuts Events
Single Sign-On
UIKitSystem
BackgroundTaskManagementAgent
com.apple.PressAndHold
CoreLocationAgent
Siri
AirPlayUIAgent
TextInputMenuAgent
TextInputSwitcher
1Password Browser Helper
Wi-Fi
EventScripts
1Password
Dropover
CursorUIViewService
Keychain Circle Notification
Universal Control
Contacts
iStat Menus Helper
Hazel Helper
Notes
CalendarWidgetExtension
SoftwareUpdateNotificationManager
nsattributedstringagent
AppSSODaemon
DockHelper
Mail Graphics and Media
SiriNCService
ABP Control Panel (Safari)
com.apple.Safari.SandboxBroker (Safari)
Safari Graphics and Media
com.apple.CoreSimulator.CoreSimulatorService
Simulator
VisualizerService (Music)
VisualizerService-x86 (Music)
Dropbox
Dropbox Activity Provider
Open and Save Panel Service
QuickLookUIService
ThumbnailExtension_macOS
SpeechSynthesisServerXPC
AccessibilityVisualsAgent
ShareSheetUI
AquaAppearanceHelper
photolibraryd
coreautha
AuthenticationServicesAgent
siriactionsd
Open and Save Panel Service (Preview)
QuickLookUIService
IMDPersistenceAgent
nbagent
OneDrive
ShareSheetUI (Finder)
Messages
OSDUIHelper
ShareSheetUI
familycircled
studentd
QLPreviewGenerationExtension
PowerChime
Open and Save Panel Service (Photos)
QuickLookUIService
System Events
FolderActionsDispatcher
BetterDisplay
AppleMusic
Hazel Notifier
Open and Save Panel Service (Hazel)
QuickLookUIService
Reddit Graphics and Media
com.apple.Safari.SandboxBroker
Open and Save Panel Service (Reddit)
QuickLookUIService
ShareSheetUI
nsattributedstringagent
KMLink
PulseOpswatService
PulseSetupClient
com.apple.Safari.SandboxBroker
Microsoft Teams WebView
com.microsoft.teams2.notificationcenter
Microsoft Teams WebView Helper (Plugin)
Microsoft Teams WebView Helper
Slack Helper (Plugin)
Open and Save Panel Service (TextEdit)
QuickLookUIService
OSAScript
CloneKitService-Hard Drive Backup (Monitored)
BetterTouchTool
BetterTouchToolAppleScriptRunner
BTTRelaunch
Reminders Graphics and Media
PrettyJSON (Safari)
Open and Save Panel Service (Script Debugger)
QuickLookUIService
Keyboard Maestro Graphics and Media
Keyboard Maestro Forum Graphics and Media
com.apple.Safari.SandboxBroker
Open and Save Panel Service (Keyboard Maestro Forum)
QuickLookUIService

Macro Screenshot (click to expand/collapse)

Discrepancy between running apps token and for each action demo macro.kmmacros (6.2 KB)

"The Running Applications collection contains the paths of each of the currently running foreground applications, sorted by use." – collection:Running Applications [Keyboard Maestro Wiki]

The %Application%All% token is said to be for "All of the applications, one per line, from front to back" (token:Application Tokens [Keyboard Maestro Wiki]) and that includes background applications.

I made the issue of foreground/background applications explicit in a suggestion I made for a revised version of that page: Suggested edit for "Application Related Tokens" page

2 Likes

Hmm... I guess it seems a little ambiguous to me, since the applications token wiki mentions running applications much like the collection wiki. To me, that means GUI apps that I can interact with, like the ones the collection returns. But it apparently includes application processes (might be the wrong nomenclature), for example:

SiriNCService
AppSSODaemon
photolibraryd
coreautha

I honestly don’t care about those items, although some folks would find it useful.

EDIT: I like your proposal you linked to, thanks for sharing!

1 Like

Then don't return them -- use %Application%Foreground% instead.

This really is a case of "you get what you ask for" :wink:

4 Likes

That’s way too logical and simple! :sweat_smile: I don’t know how I missed that particular parameter :man_facepalming:t2:

3 Likes