The mouse click script always click at my mouse's current position

491 views
Skip to first unread message

Danyl Bekhoucha

unread,
Jul 7, 2017, 4:49:36 PM7/7/17
to autokey-users
Hi,

this script and the other one always click at my mouse's current position instead of clicking in the x and y position:

mouse.click_absolute(1000, 500, 1)

mouse.click_relative_self(1000, 500, 1)

How can i make it work? I want to use it in the game Dota to go from jungle camps automatically.

Joe

unread,
Jul 8, 2017, 4:24:16 AM7/8/17
to AutoKey Users, Danyl Bekhoucha
Resending - to list.

I haven't done anything with mouse actions in AutoKey, so I can't answer
specifically.

We need more information to help you get a good answer. The more you
tell us, the more likely you are to get a good answer quickly. Please see:

https://github.com/autokey/autokey/wiki/Problem-Reporting-Guide

In particular, there are known issues with mouse actions in AutoKey 0.90
and 0.91. I understand these have been solved in 0.93 which is available
from:

https://github.com/guoci/autokey-py3

So, at a minimum, we need to know what version of AutoKey you are using.
A trace would also show us what AutoKey is trying to do.

FYI: AutoKey 0.93 also has xautomation integration which means you can
use simple pattern recognition to find the screen element you want to
position to without having to hard code the coordinates. This allows
your code to continue to succeed if the element you're looking for gets
moved in a subsequent release of the target application.

Joe
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Danyl Bekhoucha

unread,
Jul 8, 2017, 7:41:35 AM7/8/17
to autokey-users, dbek...@gmail.com
Hi,

thank you for your answer.

I have the latest version 0.93.10.

To test the mouse i use GIMP and create a 1920x1080 image and use the Paint brush tool.

If for example i execute this script:

mouse.click_absolute(500, 800, 1)

or this one (haven't noticed any difference):

mouse.click_relative_self(500, 800, 1)

The script doesn't work all the time so i had to add a delay before the click and it works, a point appears but in Dota it left click where the mouse is pointing:

time.sleep(0.1)
mouse.click_absolute(500, 800, 1)

I have tried the same thing with the right click but the menu appears where the cursor is instead of using the x and y coordinates, i think if i could fix that that will work in Dota:

time.sleep(0.1)
mouse.click_absolute(500, 800, 3)

Danyl Bekhoucha

unread,
Jul 8, 2017, 7:57:48 AM7/8/17
to autokey-users
There is a difference between absolute and relative my bad, but same issue for both with the right click that opens a menu at the mouse's current position*

It seems that the mouse especially the right click is clicking before it gets in the entered coordinates i would like to have a delay. But it's weird that it moves at the entered XY coordinates in GIMP with the left click but doesn't in Dota. I have tried every display modes: Desktop-Friendly fullscreen, Windowed and Borderless Window.

Joe

unread,
Jul 8, 2017, 10:07:33 AM7/8/17
to autoke...@googlegroups.com, Danyl Bekhoucha
Let me make sure I understand what you're saying:

If you use your macro in gimp, it works correctly once you add a small
delay between whatever it just did and the mouse positioning command.

Doing the same thing in Dota does not result in the desired behavior,
but it does produce a mouse click event, so we know that the macro did run.

In gimp, the left click produces a "dot". I assume you have a drawing
tool selected.

In Dota, what is supposed to happen if the left click occurs at the
specified location? Are you sure that position is inside the "button"
(or whatever it's called) which will take you to the next camp?

If the above is correct, then:

1) What is your macro doing before the delay and the mouse click?
(Preferably, show us the whole macro.)

If it's not doing anything, then you appear to be telling me that your
computer needs a break between a couple of keypresses and a mouse click.
That doesn't sound right. You couldn't play any games like that. (See #3
below.)

I assume your computer is powerful enough to run gimp manually when
AutoKey isn't involved. Dota is certainly far more demanding than gimp
is. What's your system load like when this happens? If gimp is just
sitting there waiting for you to do something, its contribution to the
load should be almost zero. If you have more than one core and aren't
doing a lot of other unrelated stuff, then I would guess that at least
one core should be almost idle.

2) Please also post the contents of .your_macro_name.json. It will be in
the same directory as your_macro_name.py. If you didn't put it in a user
defined directory, you should find it in a directory under
~/.config/autokey/data - probably in "~/.config/autokey/data/My
Scripts". You can see the directory it's in from the main AutoKey window
when you find it to edit it.

3) I'd still like to see a trace. It would be best if you started the
trace after you have the Dota window selected and all you need to do is
run the macro.

I just read your next post and I'd really like to see what AutoKey says
about moving the mouse cursor and clicking. I've read a bunch of traces,
but I've never looked at a mouse issue before. I could never get the
mouse to do anything at all in 0.90.4. It used to work according to the
original developer, but by the time I tried it, it didn't.

4) If you see anything that looks like an error message near the end of
the trace - after you activated your macro (there may be a few
complaints earlier in the trace that are always there and don't cause
any known issues), then it might be good to see a trace with gimp where
it does work correctly so we can compare the two.

Please forgive me for knowing nothing about (online) gaming. I thought
the actual name was "Dota" before I looked it up in Wikipedia!

I assume this is Defense of The Ancients, currently owned by Valve.

Since this game was not originally designed for Linux, what special
environment does it use? Wine? PlayOnLinux?

Or, is this played directly on the web in your browser? I took a brief
look at their website and that's what it looked like. And they say it
runs on Linux. (I have heard good things about Valve.)

Can we isolate this problem to that environment?

I.e. Does this problem occur anywhere outside the environment?

Does it occur in another game/application in the same environment?

If we can't solve this, I want to do as much as possible to fully
document it. Then, you can file it as an issue with (hopefully) all the
information the current developer needs to figure it out and get it fixed.

Are we going to have to buy a battle pass so our developer can test
this? The project is currently unfunded and none of the donation links work.

It would be great if there's a demo game or a free game where this issue
can be tested.

Joe

Danyl Bekhoucha

unread,
Jul 8, 2017, 10:38:58 AM7/8/17
to autokey-users, dbek...@gmail.com
My macro does nothing else, for now i keep a simple script so here is the whole script:

time.sleep(0.1)
mouse.click_absolute(500, 800, 1)

When i use shortcut keys it works (i use 0.07 ms delay, under that it's not always detected).

I had forgotten to say that but if i enter the coordinates in my script of an icons in the game it works, it clicks on them but if i enter the coordinates in the 3D view (the ground, an element) or on the minimap it stays under the cursor.

Dota is free and is a standalone OpenGL game, the game client is Steam. If a developer want to debug it, he can go in the Heroes tab, select and hero then enter Demo mode to load a little offline map.

Joe

unread,
Jul 8, 2017, 12:05:39 PM7/8/17
to autoke...@googlegroups.com, Danyl Bekhoucha
If it's that close to working, then there's nothing I can do.

Go over to GitHub and file an issue on the autokey-py3 site.

https://github.com/guoci/autokey-py3/issues

If you don't have a GitHub account, you'll have to sign up for one, but
it's free.

Be sure to include everything you told me.

Giving a few details at a time causes a lot of extra work. If I had
received this current email first, it would have saved me several hours
of research and effort.

I suggest you take a look at
http://catb.org/~esr/faqs/smart-questions.html#intro

Studying that site will greatly improve the results you get when asking
for help.

Joe

Danyl Bekhoucha

unread,
Jul 8, 2017, 1:06:08 PM7/8/17
to autokey-users
Thank you, yes i think it's a bug i will write on the "issues page" i hope there is still an active developer because it seems that none of the issues have been assigned to a developer. :(

Thank you for your time trying to solve my problem.

Joe

unread,
Jul 8, 2017, 1:27:24 PM7/8/17
to autoke...@googlegroups.com, Danyl Bekhoucha
If you're on the -py3 repo, he's there and tries to be very helpful.

He labeled issue #87 7 days ago.

Joe
Reply all
Reply to author
Forward
0 new messages