updated keystrokes.sh

pull/16/head
Hari Sekhon 2 years ago
parent 428eb5926d
commit 2e54b3ab15

@ -36,6 +36,9 @@ Sleeps for \$SLEEP_SECS (default: 1) between clicks to allow UIs to update and p
Starts each keystroke after \$START_DELAYS seconds (default: 5) to give time to alt-tab back to your UI application and position the cursor
If given num is negative, will run indefinitely until Control-C'd
${0##*/} <num> [<keycode> <keycode> <keycode> ...]"
exit 3
}
@ -48,7 +51,7 @@ num="$1"
start_delay="${START_DELAY:-5}"
sleep_secs="${SLEEP_SECS:-1}"
if ! [[ "$num" =~ ^[[:digit:]]+$ ]]; then
if ! [[ "$num" =~ ^-?[[:digit:]]+$ ]]; then
usage "invalid non-integer '$num' given for first argument"
fi
@ -65,7 +68,12 @@ sleep "$start_delay"
timestamp "starting $num keystrokes"
echo
for i in $(seq "$num"); do
for ((i=1; ; i++)); do
# if given num is negative, will run for infinity until Control-C'd
if [ "$num" -ge 0 ] &&
[ "$i" -gt "$num" ]; then
break
fi
for key in "${keys[@]}"; do
if [[ "$key" =~ ^[[:digit:]][[:digit:]]+$ ]]; then
timestamp "keystroke $i/$num keycode $key"

Loading…
Cancel
Save