Reliable shortcut for non-ASCII text insertion

applescriptauto-completeautomationautomatorkeyboard

I occasionally use text strings such as ¯\_(ツ)_/¯ Unfortunately, I don't have a ¯ or a on my keyboard, so using such strings can be a bit of a pain, usually involving a web search and copy and paste. I'd prefer to have an easier way of typing these. Here's what I've tried so far:

  1. Set up a text replacement in System Preferences.
    • Problem: It does nothing in several apps such as Discord and Firefox.
  2. Set up an automator service running this AppleScript:
    on run {input, parameters}
    
        tell application "System Events" to keystroke "¯\\_(ツ)_/¯"
    
    end run
    
    • Problem: It outputs ¯\_(a)_/¯
  3. Set up a different automator service which
    1. Get Contents of Clipboard
    2. Set Value of Variable "clipboard"
    3. Get Specified Text "¯\_(ツ)_/¯"
    4. Copy to Clipboard
    5. Run AppleScript `tell application "System Events" to keystroke "v" using command down`
    6. Get Value of Variable "clipboard"
    7. Copy to Clipboard
    
    • Problem: Sometimes it does nothing, sometimes it pastes the original clipboard contents, sometimes it will actually paste ¯\_(ツ)_/¯. Adding 0.2 second pauses both before and after step 5 did not fix the problem.

And with that, I've run out of straightforward, reasonably simple ideas that have a chance of having a return on investment somewhere in the vicinity of their cost. Web searches haven't really produced anything other than BetterTouchTool, which is a route I'd prefer not to take at this time.

Is there a reasonably simple, free, reliable, and legal method of doing what I want to do?

I'm running 10.14.6, on a Mac with a Touch Bar. Touch Bar only solutions are generally acceptable, though solutions that can work with or without the Touch Bar are preferable.

Best Answer

Use one of the several text shortcut apps that are out there in the world.

aText (https://www.trankynam.com/atext)

Typinator (https://www.ergonis.com/products/typinator/)

Just as a couple of examples.