I want to be able to run a bash script, which sends keypresses and clicks to multiple windows. This does NOT necessarily have to be done with xdotool, if there is an alternative I would be happy to use it. Preferably it would work with bash though.
So, if I had three windows, all of which I wanted to send the "w" key to, I would need to do something like set the active window as each in quick succession followed by sending the w key.
I want to be able to do it simultaneously, so this will not work very well.
You would need to know the window names beforehand, i.e before running the script .. You could do it this way
#!/bin/bash
for winname in "$@"
do
xdotool type --window $(xwininfo -int -name "$winname" | egrep -o 'Window id: [0-9]+' | cut -d ' ' -f 3) w
done
Output
$./script1.bash "*Untitled 1 - Mousepad" "*(Untitled)" "[No Name] + - GVIM"
Above script sends w
keystroke to all window names that are specified on the command line.
PS: for me i have 3 editors opened in the following order: Mousepad, Leafpad and GVIM