4

I want to send alt+f7 keys from autokey. Following are the code samples which I tried:

  • keyboard.send_keys("<alt>+<f7>")

  • keyboard.send_key("<alt>+<f7>")

  • keyboard.fake_keypress("<alt>+<f7>")

I tried with repeat=1 also. It doesn't seem to work. Can anyone tell me how to make this work?

5
  • Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.
    – Videonauth
    May 18, 2016 at 3:00
  • @Videonauth I don't know how I could clarify more? I want to send alt+f7 keys from autokey. I have also included the code samples which I tried.
    – q126y
    May 18, 2016 at 3:15
  • Well i did the editing for you
    – Videonauth
    May 18, 2016 at 3:23
  • @Videonauth thanks. But I was corrected one time on stack overflow for superfluous information. autokey mentioned in title as well as tag. Is the etiquette different here?
    – q126y
    May 18, 2016 at 3:26
  • 1
    Well, we dont want stories about your pet and children in questions, but not everyone looks directly at the tag, so adding a little sentence about what you want to achieve and what you tried isn't superfluous. And you only had the tag which made it almost impossible to determine whats going on.
    – Videonauth
    May 18, 2016 at 3:29

3 Answers 3

4

This script worked for me on Ubuntu 18.04 and autokey-gtk 0.90.4:

keyboard.press_key('<alt>')
keyboard.fake_keypress('<f7>')
keyboard.release_key('<alt>')

I observe about a second delay though before the script executes. Maybe its just on my computer.

1
  • same annoying delay on my ubuntu 20
    – n0tis
    Nov 29, 2022 at 10:50
0

It seems that Ubuntu 16.04 doesn't allow the system wide keyboard shortcuts to be emulated by autokey.

6
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
    – Videonauth
    May 20, 2016 at 16:03
  • 2
    @Videonauth I am the author. Since the comment thread in question was very long, I provided the answer here to provide visibility for others who may be facing similar issue.
    – q126y
    May 20, 2016 at 16:13
  • 2
    @Videonauth: I disagree. A question "how can I achieve A through B?" may very well have the answer "A is unachievable through B". If you disagree with that assessment it still remains an answer as per the guidelines of AU. Wrong™ answers are still answers. May 23, 2016 at 13:07
  • 1
  • 1
    @Videonauth How frustrating : / Jun 30, 2016 at 19:36
0

Autokey scripts are plain Python files. Autokey uses Python scripting engine. So please check your script by running directly in Python and if it works there then it will work in Autokey too.

You can also try

keyboard.press_key("<alt>")
keyboard.send_keys("<f7>")
keyboard.release_key("<alt>")
1
  • 1
    You should add some delay between each keystrokes with this command: time.sleep(0.1) May 2, 2017 at 18:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .