• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Show Emoji & Symbols GUI access
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Show Emoji & Symbols GUI access


  • Subject: Re: Show Emoji & Symbols GUI access
  • From: Yvan KOENIG <email@hidden>
  • Date: Tue, 7 Nov 2017 10:06:57 +0100

The version posted on Mon, 06 Nov 2017 21:06:02 +0100 doesn't assume any
localisation setting and doesn't assume the location of the Emoji item in the
menu extra.
I was not fully satisfied of it because when it's the menu extra which is
used,the script behaved as a switch able to close the Emoji pane when it is
already open which is not what is done when it uses the Edit > Emoji & Symbols
menu item.

The version below take care of that and the script behaves the same in both
cases.


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

                set theBundle to (path to library folder from system domain as
text) & "Frameworks:AppKit.framework:"
                set Show_loc to localized string "Show" from table "Common" in
bundle (theBundle as «class furl»)
                set Hide_loc to localized string "Hide" from table "Common" in
bundle (theBundle as «class furl»)
                # 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…"}
                                                set switchEmojiItem to first
menu item whose name contains EmojiAndSymbols_loc
                                                if name of switchEmojiItem
contains Show_loc then
                                                        click switchEmojiItem
                                                else
                                                        key code 53 # Escape to
hide the menu
                                                end if
                                        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

Yvan KOENIG running High Sierra 10.13.1 in French (VALLAURIS, France) mardi 7
novembre 2017 10:06:52



 _______________________________________________
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

  • Follow-Ups:
    • Re: Show Emoji & Symbols GUI access
      • From: Jim Underwood <email@hidden>
References: 
 >Show Emoji & Symbols GUI access (From: Jean-Christophe Helary <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: 2551phil <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: Jean-Christophe Helary <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: Jean-Christophe Helary <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: 2551phil <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: Yvan KOENIG <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: Jean-Christophe Helary <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: Yvan KOENIG <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: David Gregg <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: Yvan KOENIG <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: Jim Underwood <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: Yvan KOENIG <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: David Gregg <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: Jean-Christophe Helary <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: David Gregg <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: Jean-Christophe Helary <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: Yvan KOENIG <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: Jean-Christophe Helary <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: Yvan KOENIG <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: Jim Underwood <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: Shane Stanley <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: Jim Underwood <email@hidden>)
 >Re: Show Emoji & Symbols GUI access (From: Shane Stanley <email@hidden>)

  • Prev by Date: Running an Applescript in Mail
  • Next by Date: Re: Zoom question
  • Previous by thread: Re: Show Emoji & Symbols GUI access
  • Next by thread: Re: Show Emoji & Symbols GUI access
  • Index(es):
    • Date
    • Thread