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?

Videonauth
  • 33,045
  • 16
  • 104
  • 120
q126y
  • 299
  • 2
  • 10
  • 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](http://askubuntu.com/help/how-to-ask) page for help clarifying this question. – Videonauth May 18 '16 at 03: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 '16 at 03:15
  • Well i did the editing for you – Videonauth May 18 '16 at 03: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 '16 at 03: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 '16 at 03:29

3 Answers3

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.

0

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

q126y
  • 299
  • 2
  • 10
  • 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](/review/low-quality-posts/567222) – Videonauth May 20 '16 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 '16 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. – David Foerster May 23 '16 at 13:07
  • 1
    @Videonauth Relevant Meta post: [If an answer cannot possibly give you what you asked for, please consider accepting nevertheless](http://meta.askubuntu.com/questions/15660/if-an-answer-cannot-possibly-give-you-what-you-asked-for-please-consider-accept?cb=1) – Nick Weinberg Jun 30 '16 at 18:51
  • @NickWeinberg I have read and understood the comments before that, still I can't retract a review I did at that time. So this means i can delete my first comment, but the whole answer will be stuck in the review queue until its done being reviewed. – Videonauth Jun 30 '16 at 18:54
  • 1
    @Videonauth How frustrating : / – Nick Weinberg Jun 30 '16 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>")
dhiya
  • 943
  • 3
  • 15
  • 31