I am trying to integrate a simple infinite click script using XDOToool with another piece of script to detect keyboard input; to end the running clicking script when a key is pressed but unsure how to match them up.
This script runs infinitely repetitively clicking at screen cursor point XXX, YYY determined by XDOTool
#!/bin/bash
while true [ 1 ]; do
xdotool mousemove XXX YYY click 1 &
sleep 1.5
done
Next I wish to use something like:
#!/bin/bash
if [ -t 0 ]; then stty -echo -icanon -icrnl time 0 min 0; fi
count=0
keypress=''
while [ "x$keypress" = "x" ]; do
let count+=1
echo -ne $count'\r'
keypress="`cat -v`"
done
if [ -t 0 ]; then stty sane; fi
echo "You pressed '$keypress' after $count loop iterations"
echo "Thanks for using this script."
exit 0
I don't understand how I take the:
xdotool mousemove XXX YYY click 1 &
sleep 1.5
And where to put it in the script above, BASH confusion and MAN BASH doesn't help so anyone who could assist would be appreciated. THANKS