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 focus, etc... 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 very neatly. 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? thanks By the way, here is my bash script: #!/bin/bash # 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 sleep 0.01 # type out desired text in $3 xdotool type "$3" && xdotool key Return && sleep 0.2 sleep 0.01 |
This is from xdtool documentation:
Quote:
|
I will try a different approach
Quote:
I guess I will just spin my own by using imlib2 and not use a bash wrapper to call SCROT and xdotool. The results of a dedicated peice of code to capture a portion of the window in focus will certainly execute a lot faster than Take care |
All times are GMT -5. The time now is 01:00 PM. |