Using SCROT to capture portion of window
Scrot supports capturing a portion of the screen by
allowing the user to use the -s option. I need to
use the command line.
So I installed xdotool to allow me from the command line
to move my mouse, click buttons, type text, select my
I also built a bash script that uses scrot and xdotool
that allows me to select the window that has a firefox
web page displayed. Then I can position the mouse and
do a right button click to position to a data entry box
on the web page. Then I can use xdotool type "my text"
to input the text into the input box. All this works
My problem is the following:
The command "xdotool mousemove x y" does not move relative
to the top left hand corner of the focused window. The command
moves to the absolute x y screen location, not the relative window location.
This happens even though I use the command "xdotool windowfocus
windowid" or command "xdotool windowactivate windowid" to specify
which window I want to use (want in focus).
Does anybody know how to specify that the
"xdotool mousemove x y" is
to move relative to the upper left hand
corner of the currently
in focus window?
By the way, here is my bash script:
# get window id
WIN_ID=`xdotool search --title MyWindow`
# activate window with title MyWindow
xdotool windowactivate $WIN_ID
# move to x, y location -- this is an absolute screen location move
xdotool mousemove $1 $2
# how does one do a relative location move based on focused window?
# do a left button click
xdotool click 1
# type out desired text in $3
xdotool type "$3" && xdotool key Return && sleep 0.2