Mouse simulating movement and click
At @pan64 recomandation I open this new tread for my request.
I found here a nice code for simulating mouse movement and click without using additional Linux tools installed. Code:
#include <stdio.h> Code:
gcc -o autoclick autoclick.c -lX11 ./autoclick 50, 50, 1 Starting in 3 2 1... and that it's all. I try change the coordinates but nothing happen or button. What I do wrong? |
Works here. That is, it works after fixing the compiler warnings due to missing headers:
Code:
#include <unistd.h> |
Thanks for answer.
I added the header you give me, recompiled and run it again. It happen the same, don't do anything with command: ./autoclick 50, 50, 1 Starting in 3 2 1... I tried change the coordinates and button, nothing change!!! If I understood well button 1, 2, 3 should be mouse buttons left, middle and right? By the way, it will be good also a parameter for time to keep pressed. Thanks again |
On my system it generates a click every 1 second. What are you putting your mouse over in order to check it?
|
Quote:
|
Eeee is not what I expect do....
OK. I found now another one which seams it clicks where I want. Code:
#include <X11/Xlib.h> I try to add also a time argument and create a function: Code:
click(){ Question: in this situation if I want set 1.5s ...? Or perhaps is better call like that Code:
click(){ |
the Button parameter is still not handled by the c code you posted. You need to take care about the third argument and pass it to the function mouseClick.
The last code you posted is probably a shell script, but I'm not really sure, because syntactically incorrect. I don't really understand what do you want to achieve. also someone suggested xdotool probably that will be much easier for you: https://theembeddedlab.com/tutorials...-raspberry-pi/ |
Just curious:
Do you already know about xdotool? |
I am not running the code in a regular distribution of Linux. It's true that I tested on Ubuntu. But there is an embedded distribution Yocto, if I don't mistake which can't have these tools and update online as I want and there I want play with this.
As much I understand from code of moving mouse and click me too I don't see making difference on button. But running with choise of button 2, 3 it's clicking. Yes the last pieces of code are shell script where I want call and use. xdotool must be installed before run. If you see what is incorrect and advice me to fix, I will be happy. If is regarding call: click 710,450,2 I already realized that is mistake. Thanks @pan64 |
if you want to validate your shell script please try www.shellcheck.net
what I can see is: the $ is not required before click, but obviously it is not the full script, so there can be other problems too. I don't know, but probably xdotool is also available on your embedded system (so probably you can install it easily). Also, you must not add comma (,) between arguments, space is enough |
Hi guys,
This is the code I want run: Code:
#!/bin/bash Even the other command show_screen doesn't execute. I insert even zenity command for test and also don't execute. I do something wrong? Any ideea? |
looks like your program does not find the display. Does the variable DISPLAY set correctly?
You have no error handling in your scripts and also you could write some [more] info in a logfile to see what's happening and what went wrong. |
In Ubuntu after compilation the command mouseclick generated works well.
But I want use it in other distribution Poky (Yocto) and here seams doesn't react at all. Here I don't see the terminal and I lunch it trough a bash script but I don't see any reaction!!!! Perhaps don't find Display, but how to adjust for check what's going wrong? |
All times are GMT -5. The time now is 03:06 PM. |