Re: Show Emoji & Symbols GUI access
Re: Show Emoji & Symbols GUI access
- Subject: Re: Show Emoji & Symbols GUI access
- From: David Gregg <email@hidden>
- Date: Mon, 06 Nov 2017 10:50:59 -0700
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?
> On Nov 6, 2017, at 10:40 AM, Yvan KOENIG <email@hidden> wrote:
>
> It appears that it's quite easy to build an universal version.
> If the active application uses the localized string, the menu item is named
> EmojiAndSymbols_loc
> If it doesn't, the menu item is named the English way : "Emoji & Symbols".
>
> set theSource 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 (theSource as «class furl»)
>
> tell application id "com.apple.systemevents"
> 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"}
> try
> 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"
> set itemEmoji to first menu item whose name is
> EmojiAndSymbols_loc or name is "Emoji & Symbols"
> click itemEmoji
> end tell
> on error
> error "There is no Emoji item available in the
> frontmost application !"
> end try
> end tell
> end tell -- System Events
>
>
> Yvan KOENIG running High Sierra 10.13.1 in French (VALLAURIS, France) lundi 6
> novembre 2017 18:29:16
>
>
>
>
>
> _______________________________________________
> 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
_______________________________________________
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