Thanks.
I’m too lazy to build a code automating the entire process.
Here is the best result I was able to get.
tell application "System Events"
-- (every menu bar item of every menu bar of every application process whose subrole = "AXMenuExtra")
(*
{{}, {}, {{}}, {}, {}, {{}}, {}, {}, {{}}, {}, {{menu bar item "Centre de notifications" of menu bar 1 of application process "SystemUIServer" of application "System Events", menu bar item "Siri" of menu bar 1 of application process "SystemUIServer" of application "System Events", menu bar item 3 of menu bar 1 of application process "SystemUIServer" of application "System Events", menu bar item 4 of menu bar 1 of application process "SystemUIServer" of application "System Events", menu bar item 5 of menu bar 1 of application process "SystemUIServer" of application "System Events", menu bar item 6 of menu bar 1 of application process "SystemUIServer" of application "System Events", menu bar item 7 of menu bar 1 of application process "SystemUIServer" of application "System Events", menu bar item 8 of menu bar 1 of application process "SystemUIServer" of application "System Events", menu bar item 9 of menu bar 1 of application process "SystemUIServer" of application "System Events"}}, {}, {{}}, {{menu bar item "Spotlight" of menu bar 1 of application process "Spotlight" of application "System Events"}}, {{}}, {}, {}, {}, {{}, {menu bar item 1 of menu bar 2 of application process "popCalendar" of application "System Events"}}, {{menu bar item 1 of menu bar 1 of application process "SMARTReporter" of application "System Events"}}, {{}, {menu bar item 1 of menu bar 2 of application process "FastScripts" of application "System Events"}}, {}, {}, {}, {}, {{menu bar item 1 of menu bar 1 of application process "FrontendAgent" of application "System Events"}}, {{}}, {{}}, {{}}, {{}}, {}, {}, {}, {}, {}, {{}}, {}, {{}}, {}, {}, {{}}, {}, {{}}, {}, {}, {}, {}, {{}}, {{}}, {{}}}
*)
set theItems to {}
set end of theItems to name of menu bar item "Centre de notifications" of menu bar 1 of application process "SystemUIServer" of application "System Events"
set end of theItems to name of menu bar item "Siri" of menu bar 1 of application process "SystemUIServer" of application "System Events"
set end of theItems to description of menu bar item 3 of menu bar 1 of application process "SystemUIServer" of application "System Events"
set end of theItems to description of menu bar item 4 of menu bar 1 of application process "SystemUIServer" of application "System Events"
set end of theItems to description of menu bar item 5 of menu bar 1 of application process "SystemUIServer" of application "System Events"
set end of theItems to description of menu bar item 6 of menu bar 1 of application process "SystemUIServer" of application "System Events"
set end of theItems to description of menu bar item 7 of menu bar 1 of application process "SystemUIServer" of application "System Events"
set end of theItems to description of menu bar item 8 of menu bar 1 of application process "SystemUIServer" of application "System Events"
set end of theItems to description of menu bar item 9 of menu bar 1 of application process "SystemUIServer" of application "System Events"
try
name of application process of (menu bar item 1 of menu bar 2 of application process "popCalendar" of application "System Events")
on error errMsg
set end of theItems to my extractName(errMsg)
end try
try
name of application process of (menu bar item 1 of menu bar 1 of application process "SMARTReporter" of application "System Events")
on error errMsg
set end of theItems to my extractName(errMsg)
end try
try
name of application process of (menu bar item 1 of menu bar 2 of application process "FastScripts" of application "System Events")
on error errMsg
set end of theItems to my extractName(errMsg)
end try
try
name of application process of (menu bar item 1 of menu bar 1 of application process "FrontendAgent" of application "System Events")
on error errMsg
set theName to my extractName(errMsg)
--if theName contains "FrontendAgent" then set end of theItems to "MalwareBytes"
if theName is "\"FrontendAgent\"." then set end of theItems to "MalwareBytes"
end try
end tell
theItems
(*
{"Centre de notifications", "Siri", "AppleScript", "time machine", "bluetooth", "text input", "volume 19 %", "Horloge", "Wi-Fi, Wi-Fi non activé.", "\"popCalendar\".", "\"SMARTReporter\".", "\"FastScripts\".", "MalwareBytes"}
*)
on extractName(errMsg)
set AppleScript's text item delimiters to "application process "
set theName to last text item of errMsg
set AppleScript's text item delimiters to ""
return theName
end extractName
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) samedi 15 décembre 2018 20:11:17