I got it :
tell application "iTunes" to activate
tell application "System Events" to tell process "iTunes"
set frontmost to true
tell window 1
-- class of UI elements --> {button, button, pop up button, radio group, radio group, button, button, button, slider, scroll area, pop up button, text field, button, button, button, splitter group}
tell splitter group 1
-- class of UI elements--> {browser, splitter, scroll area}
tell scroll area 1
-- class of UI elements--> {outline, scroll bar, scroll bar}
tell outline 1
-- class of UI elements --> {group, column, column, column, column, column, column, column, column, column, column, column, column, column, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row, row,…}
tell row 8
set its selected to true
perform action "AXShowMenu"
end tell
end tell
end tell
end tell
repeat 100 times
set uiElements to class of UI elements --> {button, button, pop up button, radio group, radio group, button, button, button, slider, scroll area, pop up button, text field, button, button, button, splitter group, menu}
if uiElements contains menu then exit repeat
delay 1
end repeat
tell UI element -1 -- replace tell menu 1
click it
-- name of menu items of menu 1 -- is the standard syntax but here it fails.
name of menu items --> {"Supprimer le téléchargement", "Ajouter à la playlist", missing value, "Lire ensuite", "Lire plus tard", "Créer une station", "Suggestions Genius", missing value, "Informations sur le morceau", "Aimer", "Je n’aime pas", "Décocher la sélection", missing value, "Afficher l’album dans la bibliothèque", "Afficher dans Apple Music", "Afficher dans l’iTunes Store", "Partager le morceau", missing value, "Copier", missing value, "Supprimer de la bibliothèque"}
end tell
end tell
end tell
The wanted item appears in the list of UI elements as a menu item but it’s not really a standard one.
If we try to trigger it as a menu we get an error.
We must trigger it as 'ui element ‘1’ which means the last of the list.
And we discover that it’s not built like a standard menu, the menu items aren’t belonging to menu 1 of the menu but they belong to the menu itself.
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) dimanche 26 janvier 2020 22:57:27