My script goes bad because there is “EyeTV” and “EyeTV Helper” processes. What ps “code” lists only apps which has GUI.
I’m about 93.5% positive there isn’t one.
Maybe this is sufficient
tell application "System Events"
get processes whose visible is true
end tell
That will exclude GUI apps the user has hidden via command-H or one of its variants.
tell application "System Events"
get processes whose background only is false
end tell
Much better, Mikey