Espanso and Shortcuts

I just read an article on the Sweet Setup on Espanso, a free, open source alternative to Text Expander. It uses YAML files for configuring trigger and replacement text. I’ve played around with it a little and I really like it. However, since it doesn’t really have a UI, I’m thinking about creating a shortcut to allow for quick entry of new replacement text in an Espanso configuration file. Given the way it works, it looks fairly easy to automate with Shortcuts on the Mac.

Yeah I’ve been using Espanso for a while now, especially on my Windows machine at the office. What I especially like about it is that I can code complex substitutions using my language of choice (Python in my case). It definitely feels like a solution aimed at programers, which suites me just fine.

1 Like

Well, I did decide to create a shortcut for adding text replacement entries to Espanso. I thought I had it working, but now it doesn’t seem to want write to my Espanso configuration file. If I set the path in the Append action, it works. If I use a path defined in a text field, it can’t open the file:

Here is a link to the shortcut: Add Text Replacement to Espanso

Anyone have any ideas why I’m running into this error? My file exists at the path defined in the shortcut.

Instead of referencing the file manually, I would call it using the File action in shortcuts and using that as a magic Variable in your append action. I have mixed luck with text based file paths in shortcuts.

1 Like

Thanks! I think I settled on the fact that configuring the path as text wasn’t really buying me much over just choosing the path in the Append to Text File action.

What happens if you use the full path rather than the ~ home directory expansion? I often come across issues in automations that include that expansion when triggered outside of the terminal. I wonder if that could be an issue here?

I tried with the full path as well and had the same problem.