Re: Show Emoji & Symbols GUI access
Re: Show Emoji & Symbols GUI access
- Subject: Re: Show Emoji & Symbols GUI access
- From: Yvan KOENIG <email@hidden>
- Date: Mon, 6 Nov 2017 21:06:02 +0100
> Le 6 nov. 2017 à 19:55, Yvan KOENIG <email@hidden> a écrit :
>
>
>
>> Le 6 nov. 2017 à 18:50, David Gregg <email@hidden> a écrit :
>>
>> Yvan,
>>
>> That’s great, thanks for bringing that localization routine to my attention.
>>
>> So for those apps that don’t have an emoji menu item you could revert to the
>> use of the menu bar version in the error block?
>>
>
> It may be done but at this time I'm searching the file containing the
> localized strings spelled : "Afficher les Emoji et symboles".
>
> Yvan KOENIG running High Sierra 10.13.1 in French (VALLAURIS, France) lundi 6
> novembre 2017 19:55:41
The entire string is not available so I don't use "is" but "contains".
set theBundle to (path to library folder from system domain as text) &
"Frameworks:Carbon.framework:Versions:A:Frameworks:HIToolbox.framework:"
set EmojiAndSymbols_loc to localized string "Emoji & Symbols" from table
"Menus" in bundle (theBundle as «class furl»)
tell application id "com.apple.systemevents"
try
tell (first process whose frontmost is true) to tell menu bar 1
--get name of menu bar items
(*{
01 - "Apple",
02 - "???????",
03 - "Fichier",
04 - "Édition",
…}
*)
set mt to 4
--get name of menu bar item mt -- {"Édition"}
tell menu bar item mt to tell menu 1
# If the app uses the localized string the item
is named EmojiAndSymbols_loc
# If it doesn't, the item is named the English
way : "Emoji & Symbols"
click (first menu item whose name is
EmojiAndSymbols_loc or name is "Emoji & Symbols")
end tell
end tell
on error
# Try to use the menu Extra “Visualiseurs…”
tell process "SystemUIServer"
try
set keyboardExtras to first item of (menu bar
items of menu bar 1 whose value of attribute "AXDescription" = "text input")
tell keyboardExtras
perform action "AXPress" # Reveal the
menu items
tell menu 1
--name of menu items -->
{"Afficher le visualiseur de clavier", "Afficher les Emoji et symboles",
missing value, "Ouvrir les préférences Clavier…"}
click (first menu item whose
name contains EmojiAndSymbols_loc or name contains "Emoji & Symbols")
end tell # menu 1
end tell
on error
error "The Menu Extra “Emoji…” is not available
in the menu bar !"
end try
end tell
end try
end tell -- System Events
I apologize but I don't know how the menu extra is named in English.
I would be interested by feedback from an eastern user, Japanese for instance.
Yvan KOENIG running High Sierra 10.13.1 in French (VALLAURIS, France) lundi 6
novembre 2017 21:04:30
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden