1

(Autokey's documentation is discontinued so i am posting here since it's a Linux software and there is no forum available)

I use Autokey to create macros for games, but i haven't found in the documentation the script to:

  • do a right click

  • do a left click

  • do a middle click

  • move the cursor to a specific location

Danyl Bekhoucha
  • 191
  • 1
  • 2
  • 8
  • Use [`xdotool`](https://www.semicomplete.com/projects/xdotool/xdotool.xhtml#mouse_commands) – wjandrea May 02 '17 at 18:52
  • 1
    For AutoKey, it looks like there's [documentation about mouse scripting on GitHub](https://github.com/autokey/autokey/blob/master/doc/scripting/lib.scripting.Mouse-class.html) in raw HTML form. – wjandrea May 02 '17 at 18:57
  • Thank you a lot, that solve my problem for left, right and middle clicks and mouse to a specific position. I post the answer. I will then post everything for game macro here: https://askubuntu.com/questions/898564/how-can-i-create-macros-for-games-on-linux – Danyl Bekhoucha May 02 '17 at 19:07
  • here is the documentation page, in rendered html: https://autokey.github.io/lib.scripting.Mouse-class.html – DrGecko Oct 27 '20 at 13:32

2 Answers2

4

To click use this two commands:

mouse.click_relative_self(x, y, button)

mouse.click_absolute(x, y, button)

The first command is relative (to click near the mouse's current location) the second is absolute (from the entire screen). The button takes 3 arguments:

1: left click

2: middle click

3: right click

For example in a strategy game to perform a right click at the mouse's current location do this:

mouse.click_relative_self(0, 0, 3)
Danyl Bekhoucha
  • 191
  • 1
  • 2
  • 8
1

The documentation for AutoKey's Mouse API can now be found here: https://autokey.github.io/api/mouse.html

Liam Bohl
  • 111
  • 3