cliclick
cliclick copied to clipboard
Support for repeated commands
I know that cliclick can work from a commands file, or that I could write a bash loop; however, I'd love to see syntax like (inspired by xdotool):
> cliclick --repeat 500 -w 20 c:. => generate 500 click events at the current mouse position, one every 20ms
cliclick has a nice command chaining syntax, so maybe a better approach is to extend the algebra you've already written:
> cliclick -w 20 c:.*500 (same 500 clicks, once every 20ms as before)
allowing paren would enable more complicated logic:
> cliclick (c:.*5 m:+100,+100 w:20)*5 (5 clicks, move, wait, repeat all 4 more times)
I think given the current syntax and the current code for “parsing” the syntax (which is no parsing, but simply reading a space-separated list of arguments), the most convenient syntax would be something like this:
cliclick repeat:500 c:. endrepeat
But just out of curiosity: what is the point of being able to do that? What would be a usage scenario?
I think your proposed syntax looks fine.
Frankly, my use case would be for autoclicking scenarios, and wouldn't need any grouping logic- I proposed it as a natural extension to the repeat feature.
I think given the current syntax and the current code for “parsing” the syntax (which is no parsing, but simply reading a space-separated list of arguments), the most convenient syntax would be something like this:
cliclick repeat:500 c:. endrepeatBut just out of curiosity: what is the point of being able to do that? What would be a usage scenario?
That doesn't work for me... is it implemented?
No, not implemented – that’s the reason why this issue is still open.
In the mean time, one could do something like this to click repeatedly with a pause in between, and exiting after a certain amount of time:
#!/usr/bin/env bash
cliclick -e 200 m:1002,848 w:200
while true
do
[[ "$SECONDS" -lt 10 ]] || exit
cliclick c:1002,848 w:1000 t:Test
done
$SECONDS is a bash internal variable; the timer stars with the creation of a shell.
EDIT: Disclaimer: don't use while true ... done without some sort of exit mechanism.