• 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: Jim Underwood <email@hidden>
  • Date: Wed, 8 Nov 2017 00:16:01 +0000
  • Thread-topic: Show Emoji & Symbols GUI access

Hey guys, thanks to the great work by Yvan and others, I now have a script for
this that is both fast, and should work for all locals.
This is somewhat different in that it will toggle the Emoji window (like an
earlier version by Yvan).

One thing, not used in this script, that I need help with:  How to get
localized version of "Favorites":
set favFolderName to localized string favFolderName from ??? -- anyone know?

Please let me know what you think.

________________________________

property ptyScriptName : "Toggle Show/Hide of Emoji Window"

property ptyScriptVer : "3.0"

property ptyScriptDate : "2017-11-07"

property ptyScriptAuthor : "JMichaelTX" -- based on script by Yvan Koenig

# While this script is based largely on scripts by others, all errors are mine.


(*

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PURPOSE:

  • Quickly Show/Hide the Emoji & Symbols Window

    that should work in any macOS language


REQUIRED:

  1.  macOS 10.11.6+ (may work on earlier versions, but I have not tested any
other versions)

  2.  Mac Applications

      • System Preferences > Keyboard must be set to:

        "Show Keyboard, Emoji, & Symbol Viewers in menu bar"


REF:  This script is based largely on:


  1.  Yvan KOENIG, 2017-11-07, Show Emoji & Symbols GUI access -- ASUL

      http://lists.apple.com/archives/applescript-users/2017/Nov/msg00079.html



  2. Aviral Bansal, 2016-04-02, Speed up AppleScript UI scripting? - Stack
Overflow

      https://stackoverflow.com//a/36370637/915019



  3. Thomas Floeren, 2017-11-07, Suggestion on ASUL to Use “killall System
Events”

      http://lists.apple.com/archives/applescript-users/2017/Nov/msg00083.html

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

*)


use AppleScript version "2.4" -- Yosemite (10.10) or later

use framework "Foundation" -- don't really need this

use scripting additions



--- Get the localized version of "Emoji" ---


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»)


--- TODO: Get Localized Version of "Favorites" ---


set favFolderName to "Favorites" -- folder on Emoji Window (not used in this
version)

#?# set favFolderName to localized string favFolderName from ??? -- anyone know?

##TODO: Add code to select Favorites folder ##


-----------------------------------------------

--- PART 1.  Show the Emoji Viewer Menu Items

-----------------------------------------------


tell application "System Events" to tell process "SystemUIServer"



  set emojiViewerMenu to first item of ¬

    (menu bar items of menu bar 1 ¬

      whose value of attribute "AXDescription" = "text input")



  tell emojiViewerMenu



    --- Must Use "ignoring" and then "killall" to avoid ~5 sec Delay ---



    ignoring application responses

      perform action "AXPress" # Reveal the menu items

    end ignoring



  end tell -- emojiViewerMenu





end tell -- System Events -> "SystemUIServer"


-----------------------------------------------------------------

--- Finish the Process to Avoid Delay from Menu Press ---

-----------------------------------------------------------------

do shell script "killall System\\ Events"

delay 0.1


--------------------------------------------------------------------

--- PART 2. Click on the Emoji Item to Show/Hide the Emoji  Window

--------------------------------------------------------------------

(*

 NOW, Click on the Emoji Menu Item ---

    • This will toggle the display of the emoji window

    • The menu item always contains "Emoji"

    • But starts with "Show" when the window is not visible

    • Starts with "Hide" when the window is visible

*)



tell application "System Events" to tell process "SystemUIServer" to tell
emojiViewerMenu



  tell menu 1



    try

      set toggleEmojiMenuItem to first menu item whose name contains
EmojiAndSymbols_loc

      click toggleEmojiMenuItem

    on error

      error "The Menu Extra “Emoji…” is not available in the menu bar !"

    end try



  end tell # menu 1



end tell

________________________________


Best Regards,

Jim Underwood
aka JMichaelTX


From: AppleScript-Users
<applescript-users-bounces+jmichael=email@hidden<mailto:applescript-users-bounces+jmichael=email@hidden>>
 on behalf of Yvan KOENIG <email@hidden<mailto:email@hidden>>
Date: Tuesday, November 7, 2017 at 3:06 AM
To: "ASUL (AppleScript)"
<email@hidden<mailto:email@hidden>>
Subject: Re: Show Emoji & Symbols GUI access

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.
 _______________________________________________
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

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>)
 >Re: Show Emoji & Symbols GUI access (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Reading "AppleScript, the definitive guide"
  • Next by Date: Re: Reading "AppleScript, the definitive guide"
  • Previous by thread: Re: Show Emoji & Symbols GUI access
  • Next by thread: Re: Show Emoji & Symbols GUI access
  • Index(es):
    • Date
    • Thread