6

I am trying to use Autokey-py3 v0.93.10 (in Linux Mint 18.2), to generate Unicode characters using the keyboard.send_keys command. Unfortunately none of the following attempts work.

keyboard.sendkeys("—")
keyboard.sendkeys(u"\u2014")

or this attempt copied from unicode.py:

import.paste_character("—")

Can someone advise me what I am missing?

wjandrea
  • 28,235
  • 9
  • 60
  • 81
ineuw
  • 105
  • 1
  • 9

2 Answers2

6

This works for me (mostly):

keyboard.send_keys("<ctrl>+<shift>+u+" + "012b")
keyboard.send_keys("<ctrl>")

It seems to depend on the app you are writing to, the desktop environment, the distro and the version thereof...

For example, it is working now in this window - but it's not working inside LibreOffice Writer on KDE/Manjaro (although it was working there a few months ago).

ekhumoro
  • 115,249
  • 20
  • 229
  • 336
vivasteve
  • 76
  • 2
  • 2
    vivasteve, + . it works where I need it, on editing text pages on Wikipedia. – ineuw Nov 29 '17 at 21:14
  • check this post for an alternative method using phrases: https://brushingupscience.wordpress.com/2015/12/28/add-any-symbol-without-leaving-the-keyboard/ also works in libre writer - nice! – vivasteve Nov 30 '17 at 04:29
  • 1
    again thanks. It never occurred to me to try a script and assigned a key to it. In Windows I use Autohotkey extensively, it is a well documented and a superb keyboard app. – ineuw Dec 01 '17 at 19:49
  • agreed about autohotkey - but autokey is also a great app - documentation, not so good! And it's really great that we still have maintainers of the project - kudos – vivasteve Dec 01 '17 at 23:11
  • What is the need to send ? This seems to be needed. Both with and without that 2nd line, I experience inconsistencies – Cyriac Antony Sep 26 '19 at 11:02
  • 2
    @Cyriac Ctrl seems to terminate the Unicode sequence. Enter, Shift, and Space also work. – wjandrea Apr 07 '22 at 22:30
  • Please see [this](https://github.com/autokey/autokey/wiki/Unicode-Characters) which details how it works. I don't understand why we need a character after the Unicode spec, but we do. It seems like a delimiter so it gets parsed correctly. – Joe Feb 08 '23 at 07:42
1

Thanks for all the replies. Since this was posted this issue was resolved. I am using LMC 20.3 and Autokey 96.10beta, and either of the following are functioning as they should.

keyboard.sendkeys("—")
keyboard.sendkeys(u"\u2014")
ineuw
  • 105
  • 1
  • 9