Using Rich Text in AutoKey

AutoKey is a desktop automation tool that I use a lot. I use quite a few shortcuts daily, making me productive and consistent. Email template insertion is one of them. It can be done easily using phrases in AutoKey. But phrases support only simple text. But I do like HTML emails sometimes. So this is my hack.

AutoKey supports python scripts, indirectly allowing you to run bash or command line scripts. So that's what I use. I store my email templates in HTML format, then use xclip to copy that HTML into the clipboard, and then use send keys to paste it wherever I want. Here is an email template that I send once in a while.

import os
os.system("xclip -t text/html -selection clipboard -i /home/thej/emails/feedback.html")
keyboard.send_keys("<ctrl>+v")

The content of the email is in feedback.html. I have stored this as script in AutoKey. I use /feedback/ as my abbreviation or shortcut. As soon as I type it, it gets replaced by the content generated by the above code. You can see in the gif below.

Using AutoKey to send an email

I change the {name} and {project} before sending. This also gives me an option to edit a bit before sending :)

The same process can be used for writing your introductions/bio or introduction of your project etc. And it doesn't have to be an email. It can be any place that takes rich text like google docs, libre office, or blogs. It not only reduces repetitive work but also reduces mistakes.

You can read this blog using RSS Feed. But if you are the person who loves getting emails, then you can join my readers by signing up.

Join 2,159 other subscribers

1 Response

  1. August 12, 2022

    […] a post about using rich text in AutoKey. AutoKey is one of my favorite productivity […]