As I have no longer access to Catalina, I can’t test this enhanced version supposed to return more infos.
For each color it would return its hex descriptor.
tell application "System Events" to tell process "Reminders"
set frontmost to true
tell window 1
class of UI elements --> {splitter group, button, button, button, sheet}
tell sheet 1
class of UI elements --> {static text, static text, group, text field, button, button, button}
description of buttons --> {"bouton", "bouton", "pastille Liste, Personnalisé"}
tell button -1
class of UI elements --> {image, pop over}
tell pop over 1
class of UI elements --> {UI element, UI element}
tell UI element 1
class of UI elements --> --> {button, button, button, button, button, button, button, button, button, button, button, button}
-- set theColors to description of buttons --> {"Rouge", "Orange", "Jaune", "Vert", "Bleu clair", "Bleu", "Indigo", "Rose", "Violet", "Marron", "Gris", "Rose"}
set theColors to {}
repeat with aButton in theButtons
tell aButton
set {{x, y}, {w, h}} to {position, size}
tell me to set colorDesc to do shell script "/usr/local/bin/cliclick cp:" & x + w div 2 & "," & y + h div 2
set RGB to "#"
repeat with str in my decoupe(theColors, space)
set RGB to RGB & my num2hex(str as integer)
end repeat
set end of theColors to {its description, RGB}
end tell -- aButton
end repeat
--name of attributes of button 6
--value of attributes of button 6
end tell
tell UI element 2
class of UI elements --> -> {button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button, button}
set theEmblems to description of buttons --> {"Sélectionnée, Liste", "Signet", "Repère", "Cadeau", "Gâteau d’anniversaire", "Chapeau de diplômé", "Sac à dos", "Règle et crayon", "Portefeuille", "Carte bancaire", "Billets et pièces", "Haltères", "Personne qui court", "Fourchette et couteau", "Verre à vin", "Pilules et cachets", "Stéthoscope", "Fauteuil", "Maison", "Téléviseur", "Musique", "Ordinateur", "Manette de jeu", "Feuille", "Carotte", "Personne", "Couple", "Famille", "Patte", "Ours en peluche", "Poisson", "Panier de courses", "Caddie", "Cabas", "Ballon de foot", "Baseball", "Basketball", "Football américain", "Raquette de tennis", "Train", "Avion", "Bateau", "Voiture", "Parasol", "Lune", "Soleil", "Goutte d’eau", "Flocon de neige", "Feu", "Valise", "Clé et tournevis", "Ciseaux", "Compas à dessin", "Crochet", "Carré", "Cercle", "Triangle", "Forme de losange", "Cœur", "Étoile"}
end tell
end tell
end tell
end tell
end tell
end tell
return {theColors, linefeed, linefeed, theEmblems}
#=====
on decoupe(t, d)
local oTIDs, l
set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d}
set l to text items of t
set AppleScript's text item delimiters to oTIDs
return l
end decoupe
#=====
on num2hex(int)
set hi to int div 16
set lo to int mod 16
return (text item (hi + 1) of "0123456789ABCDEF") & (text item (lo + 1) of "0123456789ABCDEF")
end num2hex
#=====
I confirm that the string “Selected, Green” is just the concatenation of “Selected”, ", " and “Green”. In fact the last string is the name of the selected color.
Selected
Sélectionnée
Red
Rouge
Orange
Orange
Yellow
Jaune
Green
Vert
Light Blue
Bleu clair
Blue
Bleu
Indigo
Indigo
Rose
Rose
Purple
Violet
Brown
Marron
Gray
Gris
Pink
Rose – would be better with “Rose clair”
As you may see, there is an oddity in the localization both strings “Rose” and “Pink” are translated by “Rose” which is annoying.
Maybe somebody would be fair enough to file a bug report.
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 29 avril 2020 10:31:18