Way to close the special character viewer/pop-up?

Hey JM, since you were asking for "a better way", here is my take :wink: I do not think it is better than the macro you posted in the meantime, it's just a slim all-in-one AppleScript solution:

tell application "System Events"
    tell process "CharacterPalette"
        tell window "Characters"
            try
                click button 2 -- Faster in this case
                --click (first button whose description is "close button")
            on error
                my launchCharacters()
            end try
        end tell
    end tell
end tell

on launchCharacters()
    tell application "System Events"
        tell (first process whose frontmost is true)
            tell menu "Edit" of menu bar 1
                click menu item "Emoji & Symbols"
            end tell
        end tell
    end tell
end launchCharacters

Toggle Characters Palette.kmmacros (2.4 KB)

It makes use of the de facto already present check for an existing window (the try block, line 4).

Obviously it doesn't include any of the advanced "Show Window, Position, & Select Group" things from your macro.

1 Like