xdotool errors

timgautrey

New Member
Joined
Oct 1, 2022
Messages
2
Reaction score
0
Credits
23
ok, not new to linux, or xdotool, but am stumped on this one!
I have been a linux user for many years, and worked with command-line frequently, also written many xdotool scripts that have worked well, but now it appears that some xdo commands don't want to work on new scripts.
I refer to the sleep command. All my old scripts are fine with it, and work perfectly, but new scripts keep throwing errors. Here is a test script that i run:

#!/bin/bash
notify-send "Testing the sleep command for xdotool"
echo "Testing the sleep command for xdotool"
xdotool mousemove '400 400' sleep 10 click 1 sleep 10
echo "Did it work?"
exit

Quite simple, shouldn't go wrong, but this is the output:

tim@tim-DH61WW:~$ ./test1.sh
Testing the sleep command for xdotool
xdotool: Unknown command: 10
Run 'xdotool help' if you want a command list
Did it work?
tim@tim-DH61WW:~$

I have much more complex scripts that run fine, but tried this on 2 different pc's with the same result. any ideas?
 


@timgautrey
The problem is your co-ordinates. Because you've grouped them together in a set of single quotes, they act as a single parameter/value.
So effectively '400 400' is being used as the X parameter to your mousemove command.Then sleep is being passed as the Y parameter to mousemove and then the parser thinks that the 10 parameter to your sleep command is actually a command itself - hence getting the error about 10 not being a command! xdotool then exits without attempting to interpret the rest of the line.

This should fix your problem:
Bash:
xdotool mousemove 400 400 sleep 10 click 1 sleep 10

I hope that helps!
 

Staff online

Members online


Top