Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > fr.comp.sys.mac.programmation > #2924
| From | "M.V." <mv@gmail.com.invalid> |
|---|---|
| Newsgroups | fr.comp.sys.mac.programmation |
| Subject | Re: MacCafé + Fermeture fenêtres: Correction |
| Date | 2026-02-15 11:34 +0000 |
| Organization | M.V. & Co |
| Message-ID | <10msb0b$lf0$1@rasp.pasdenom.info> (permalink) |
| References | (2 earlier) <10mqb4d$3bcmb$1@dont-email.me> <10mqj2i$bgj$1@rasp.pasdenom.info> <10mqncc$3fn35$1@dont-email.me> <10ms4q9$8vj$1@rasp.pasdenom.info> <10ms96q$3ukfq$1@dont-email.me> |
Bonjour,
Le dimanche 15 février 2026 à 12 h 03, dans le message
<10ms96q$3ukfq$1@dont-email.me>, Joseph B a écrit :
>> En effet car le bouton de fermeture c'est UI element 2 !
>
> Hou là, non, pas dans ce cas qui est d'une complexité extrême
Ben si… essaye et tu verras !
Ce script :
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
tell application "MacCafé" to activate
tell application "System Events" to tell process "MacCafé"
click UI element 2 of window 1
end tell
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
ferme la fenêtre de la documentation (c'est bien de cette fenêtre qu'il
s'agit ? )
Si je fais :
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
tell application "System Events" to tell process "MacCafé"
tell window 1
set N to count items of UI elements
repeat with k from 1 to N
if description of UI element k contains "fermeture" then
click UI element k
exit repeat
end if
end repeat
end tell
end tell
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
alors que la fenêtre de la doc est ouverte, j'obtiens comme réponse :
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
tell application "System Events"
count every UI element of window 1 of process "MacCafé"
--> 5
get description of UI element 1 of window 1 of process "MacCafé"
--> "zone de défilement"
get description of UI element 2 of window 1 of process "MacCafé"
--> "Bouton de fermeture"
click UI element 2 of window 1 of process "MacCafé"
--> button 1 of window 1 of application process "MacCafé"
end tell
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Je n'obtiens donc que 5 UI elements et pas 212 comme tu me le dis.
Si je demande également les propriétés de UI element 2, j'obtiens bien :
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
get properties of UI element 2 of window 1 of process "MacCafé"
--> {minimum value:missing value, orientation:missing value,
position:{272, 40}, class:button, accessibility description:missing
value, role description:"Bouton de fermeture", focused:false,
title:missing value, size:{14, 16}, help:missing value, entire
contents:{}, enabled:true, maximum value:missing value, role:"AXButton",
value:missing value, subrole:"AXCloseButton", selected:missing value,
name:missing value, description:"Bouton de fermeture"}
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
qui confirme bien que UI element 2 est le bouton de fermeture.
Les UI elements 2 et 3 et 4 et 5 sont tout à la fin et ce sont les
boutons 1, 2 et 3 et le static text 1 :
<https://pic.infini.fr/9DM6ocb1/gAOqCQoM.jpg>
Les autres UI elements ne correspondent pas à
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
tell application "System Events" to tell process "MacCafé"
tell window 1
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
mais à des sous… je sais pas comment les appeler… des sous-rubriques ?
--
Michel Vauquois - <http://michelvauquois.fr>
<https://www.facebook.com/michel.vauquois.3>
Back to fr.comp.sys.mac.programmation | Previous | Next — Previous in thread | Next in thread | Find similar
Re: MacCafé + Fermeture fenêtres: Correction "M.V." <mv@gmail.com.invalid> - 2026-02-14 16:26 +0000
Re: MacCafé + Fermeture fenêtres: Correction Joseph B <joseph@nowhere.invalid> - 2026-02-14 17:24 +0000
Re: MacCafé + Fermeture fenêtres: Correction "M.V." <mv@gmail.com.invalid> - 2026-02-14 19:23 +0000
Re: MacCafé + Fermeture fenêtres: Correction Joseph B <joseph@nowhere.invalid> - 2026-02-14 20:18 +0000
Re: MacCafé + Fermeture fenêtres: Correction Joseph B <joseph@nowhere.invalid> - 2026-02-14 21:49 +0000
Re: MacCafé + Fermeture fenêtres: Correction "M.V." <mv@gmail.com.invalid> - 2026-02-15 08:39 +0000
Re: MacCafé + Fermeture fenêtres: Correction "M.V." <mv@gmail.com.invalid> - 2026-02-16 11:03 +0000
Re: MacCafé + Fermeture fenêtres: Correction Joseph B <joseph@nowhere.invalid> - 2026-02-16 12:37 +0000
Re: MacCafé + Fermeture fenêtres: Correction "M.V." <mv@gmail.com.invalid> - 2026-02-14 19:40 +0000
Re: MacCafé + Fermeture fenêtres: Correction Joseph B <joseph@nowhere.invalid> - 2026-02-14 20:53 +0000
Re: MacCafé + Fermeture fenêtres: Correction "M.V." <mv@gmail.com.invalid> - 2026-02-15 09:48 +0000
Re: MacCafé + Fermeture fenêtres: Correction Joseph B <joseph@nowhere.invalid> - 2026-02-15 11:03 +0000
Re: MacCafé + Fermeture fenêtres: Correction "M.V." <mv@gmail.com.invalid> - 2026-02-15 11:34 +0000
Re: MacCafé + Fermeture fenêtres: Correction Joseph B <joseph@nowhere.invalid> - 2026-02-15 12:37 +0000
Re: MacCafé + Fermeture fenêtres: Correction "M.V." <mv@gmail.com.invalid> - 2026-02-15 12:57 +0000
Re: MacCafé + Fermeture fenêtres: Correction Joseph B <joseph@nowhere.invalid> - 2026-02-15 17:37 +0000
Re: MacCafé + Fermeture fenêtres: Correction "M.V." <mv@gmail.com.invalid> - 2026-02-15 18:48 +0000
Re: MacCafé + Fermeture fenêtres: Correction Gilbert OLIVIER <gibert.olivier@orange.fr.invalid> - 2026-02-16 08:27 +0000
Re: MacCafé + Fermeture fenêtres: Correction Joseph B <joseph@nowhere.invalid> - 2026-02-16 09:20 +0000
Re: MacCafé + Fermeture fenêtres: Correction Gilbert OLIVIER <gibert.olivier@orange.fr.invalid> - 2026-02-16 13:51 +0000
Re: MacCafé + Fermeture fenêtres: Correction "M.V." <mv@gmail.com.invalid> - 2026-02-16 14:17 +0000
Re: MacCafé + Fermeture fenêtres: Correction Joseph B <joseph@nowhere.invalid> - 2026-02-16 17:24 +0000
Re: MacCafé + Fermeture fenêtres: Correction "M.V." <mv@gmail.com.invalid> - 2026-02-16 17:43 +0000
Re: MacCafé + Fermeture fenêtres: Correction Gilbert OLIVIER <gibert.olivier@orange.fr.invalid> - 2026-02-16 18:40 +0000
Re: MacCafé + Fermeture fenêtres: Correction Gilbert OLIVIER <gibert.olivier@orange.fr.invalid> - 2026-02-16 19:07 +0000
Re: MacCafé + Fermeture fenêtres: Correction "M.V." <mv@gmail.com.invalid> - 2026-02-16 19:12 +0000
Re: MacCafé + Fermeture fenêtres: Correction "M.V." <mv@gmail.com.invalid> - 2026-02-16 19:08 +0000
Re: MacCafé + Fermeture fenêtres: Correction Gilbert OLIVIER <gibert.olivier@orange.fr.invalid> - 2026-02-17 13:21 +0000
Re: MacCafé + Fermeture fenêtres: Correction Joseph B <joseph@nowhere.invalid> - 2026-02-16 17:24 +0000
Re: MacCafé + Fermeture fenêtres: Correction Brice <truc@bidule.fr.invalid> - 2026-02-16 14:30 +0000
Re: MacCafé + Fermeture fenêtres: Correction "M.V." <mv@gmail.com.invalid> - 2026-02-16 14:41 +0000
Re: MacCafé + Fermeture fenêtres: Correction Brice <truc@bidule.fr.invalid> - 2026-02-17 10:16 +0000
Re: MacCafé + Fermeture fenêtres: Correction "M.V." <mv@gmail.com.invalid> - 2026-02-15 13:14 +0000
Re: MacCafé + Fermeture fenêtres: Correction "M.V." <mv@gmail.com.invalid> - 2026-02-15 13:37 +0000
csiph-web