Le 23 sept. 2016 à 02:51, Shane Stanley < email@hidden> a écrit :
On 23 Sep. 2016, at 6:14 am, Yvan KOENIG < email@hidden> wrote: Assuming that I try to open a corrupted rtf file with TextEdit, I would get this kind of alert :
FWIW, that looks like a standard NSAlert, which would mean the accessibility info is coming from the OS somewhere, not TextEdit. --
Hi Shane, I know that it's issued by the System but the window belongs to the process TextEdit.
I know that the wanted value is theoretically available in a frameworks.
I may get it - with some others - with :
set thePath to (path to library folder from system domain as text) & "Frameworks:ApplicationServices.framework:Versions:A:Frameworks:HIServices.framework:"
set standardWindowLoc to my localizeThat("AXWindow:AXStandardWindow", "RoleDescriptions", thePath) --> "fenêtre standard"
set floatingWindowLoc to my localizeThat("AXWindow:AXFloatingWindow", "RoleDescriptions", thePath) --> "palette flottante"
set DialogLoc to my localizeThat("AXWindow:AXDialog", "RoleDescriptions", thePath) --> "dialogue"
set thePath to (path to library folder from system domain as text) & "Frameworks:AppKit.framework:" --Versions:C:Frameworks:HIServices.framework:"
set alertLoc to my localizeThat("alert", "Accessibility", thePath) --> "alerte"
on localizeThat(aKey, aTable, aPath) return localized string aKey from table aTable in bundle file aPath end localizeThat
But the code above returns "alerte" under 10.10 although the accessibility description and the description are returned as alert under the same 10.10. For other windows these values were already localized as written in the script : fenêtre standard, palette flottante or dialogue
Only the one which is described in English as "alert" was returning alert under 10.10. I wish to know if this anomaly stoke for every localisations or only for French one. I guess that every localized versions returned the same "alert" string - which is the non localized one - but I wish to be sure.
When we open a file, we may get several different windows/dialogs describing anomalies. One is a floating window whose subrole is "AXFloatingWindow" but two of them share the subrole "AXDialog". one is described as "dialogue", the other is described as "alert" or "alerte" given the OS. Due to that it's not easy to know how to identify them.
Since my original message I found a neat test.
For both windows, the role description is returned with the localized string "dialogue" which give the ability to use :
if (subrole1 = "AXDialog") and roleDescription1 ≠ description1 then # cette syntaxe semble valide pour 10.10, 10.11 & 10.12
When we have a dialog which is a dialog roleDescription1 = description1 = "dialogue" When we have a dialog which is an alert, roleDescription1 = "dialogue" while description1 = "alert" or "alerte" so we have roleDescription1 ≠ description1
If I have time available, I will boot from my clone of 10.10 and run it in Deutsch or Spanish for see.
Yvan KOENIG running Sierra 10.12.0 in French (VALLAURIS, France) vendredi 23 septembre 2016 10:08:34
|