Here is a script which drops a lot of processes but some unwanted ones remain.
tell application "System Events"
set allProps to properties of application processes
set theApplications to {}
repeat with aProps in allProps
if ((path of file of aProps) contains ":Applications:") and (role of aProps is "AXApplication") then set end of theApplications to {name of aProps, id of aProps}
end repeat
-- "FinderSyncExt", "popCalendar", "Box", "SMARTReporter", "FastScripts", "fake_mojave", "Box UI" would be dropped but I don't find which property would identify them
-- Of course I may use a list of exceptions as below but at dislike this scheme.
set theApplications2 to {}
repeat with aProps in allProps
if name of aProps is not in {"FinderSyncExt", "popCalendar", "Box", "SMARTReporter", "FastScripts", "fake_mojave", "Box UI"} then
if ((path of file of aProps) contains ":Applications:") and (role of aProps is "AXApplication") then set end of theApplications2 to {name of aProps, id of aProps}
end if
end repeat
{theApplications, linefeed, linefeed, theApplications2}
end tell
(*
{{{"FinderSyncExt", 86037}, {"popCalendar", 114716}, {"Box", 131104}, {"SMARTReporter", 135201}, {"FastScripts", 143395}, {"TextEdit", 147492}, {"fake_mojave", 151589}, {"Box UI", 188462}, {"Safari", 200753}, {"firefox", 258111}, {"EasyFind", 421991}, {"Script Editor", 426088}, {"Preview", 491640}, {"Pages", 635035}, {"Numbers", 680102}, {"Mail", 733363}, {"Activity Monitor", 811206}, {"Pages", 905437}}, "
", "
", {{"TextEdit", 147492}, {"Safari", 200753}, {"firefox", 258111}, {"EasyFind", 421991}, {"Script Editor", 426088}, {"Preview", 491640}, {"Pages", 635035}, {"Numbers", 680102}, {"Mail", 733363}, {"Activity Monitor", 811206}, {"Pages", 905437}}}
*)
Of course, I may use brute force and drop processes belonging to a predefined list but I dislike this scheme.
Don’t worry, when I ran it, Pages 4.3 ans Pages 8.1 were loaded.
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) lundi 15 juin 2020 17:19:04