[opensuse] script for making screenshots
Hello: I would like to make screenshots of a window at every 3 minutes. Not the full display, only one specific application window. I have KDE3 desktop. How could I write a script to do it? I use ksnapshot manually for taking screenshots of windows. Is it possible to control it from a script? Thanks, Istvan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Dne sobota 21. března 2020 20:50:39 CET, Istvan Gabor napsal(a):
I would like to make screenshots of a window at every 3 minutes. Not the full display, only one specific application window. I have KDE3 desktop.
I don't know about KDE3, but its successor in KF5 show in command line spectacle --help bunch of options how to take screenshot. So I'd try to call something like 'ksnapshot --help' from the command line and see... The rest could be just simple for loop or so. -- Vojtěch Zeisek https://trapa.cz/ Komunita openSUSE GNU/Linuxu Community of the openSUSE GNU/Linux https://www.opensuse.org/
Dne sobota 21. března 2020 21:00:02 CET jste napsal(a):
Dne sobota 21. března 2020 20:50:39 CET, Istvan Gabor napsal(a):
I would like to make screenshots of a window at every 3 minutes. Not the full display, only one specific application window. I have KDE3 desktop.
I don't know about KDE3, but its successor in KF5 show in command line spectacle --help bunch of options how to take screenshot. So I'd try to call something like 'ksnapshot --help' from the command line and see... The rest could be just simple for loop or so.
Complete example in KF5... for C in {1..100000}; do spectacle --activewindow --background --output file.$C.jpg wait 3000 done Or something similar or more elegant (infinite while loop?). :-) -- Vojtěch Zeisek https://trapa.cz/ Komunita openSUSE GNU/Linuxu Community of the openSUSE GNU/Linux https://www.opensuse.org/
On Sat, 21 Mar 2020 21:21:01 +0100, Vojtěch Zeisek wrote:
Dne sobota 21. března 2020 21:00:02 CET jste napsal(a):
Dne sobota 21. března 2020 20:50:39 CET, Istvan Gabor napsal(a):
I would like to make screenshots of a window at every 3 minutes. Not the full display, only one specific application window. I have KDE3 desktop.
I don't know about KDE3, but its successor in KF5 show in command line spectacle --help bunch of options how to take screenshot. So I'd try to call something like 'ksnapshot --help' from the command line and see... The rest could be just simple for loop or so.
Complete example in KF5...
for C in {1..100000}; do spectacle --activewindow --background --output file.$C.jpg wait 3000 done
Or something similar or more elegant (infinite while loop?). :-)
I dont'have plasma at the moment but its good to know about this option. Thanks! Istvan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Dne pondělí 23. března 2020 11:43:58 CET, Istvan Gabor napsal(a):
On Sat, 21 Mar 2020 21:21:01 +0100, Vojtěch Zeisek wrote:
Dne sobota 21. března 2020 21:00:02 CET jste napsal(a):
Dne sobota 21. března 2020 20:50:39 CET, Istvan Gabor napsal(a):
I would like to make screenshots of a window at every 3 minutes. Not the full display, only one specific application window. I have KDE3 desktop.
I don't know about KDE3, but its successor in KF5 show in command line spectacle --help bunch of options how to take screenshot. So I'd try to call something like 'ksnapshot --help' from the command line and see... The rest could be just simple for loop or so.
Complete example in KF5... for C in {1..100000}; do spectacle --activewindow --background --output file.$C.jpg wait 3000 done Or something similar or more elegant (infinite while loop?). :-)
I dont'have plasma at the moment but its good to know about this option.
I haven't used KDE3 for ages. :-) My point is that I *suppose* You can use that KDE3 screenshot tool from command line in the same way, just try to run it from command line with the --help parameter. -- Vojtěch Zeisek https://trapa.cz/ Komunita openSUSE GNU/Linuxu Community of the openSUSE GNU/Linux https://www.opensuse.org/
On 21/03/2020 16:00, Vojtěch Zeisek wrote:
I don't know about KDE3, but its successor in KF5 show in command line spectacle --help bunch of options how to take screenshot.
Among which seems to be one that allows it to be controlled over DBUS. -- A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting frowned upon? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Istvan Gabor composed on 2020-03-21 20:50 (UTC+0100):
I would like to make screenshots of a window at every 3 minutes. Not the full display, only one specific application window. I have KDE3 desktop. How could I write a script to do it?
I use ksnapshot manually for taking screenshots of windows. Is it possible to control it from a script?
You can use import from ImageMagick in a script. I don't remember if I ever figured out how to determine the window ID needed, but I'm sure there's an answer to that on the web somewhere if you can't decipher the man page better than me. -- Evolution as taught in public schools is religion, not science. Team OS/2 ** Reg. Linux User #211409 ** a11y rocks! Felix Miata *** http://fm.no-ip.com/ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 El 2020-03-21 a las 16:06 -0400, Felix Miata escribió:
You can use import from ImageMagick in a script. I don't remember if I ever figured out how to determine the window ID needed, but I'm sure there's an answer to that on the web somewhere if you can't decipher the man page better than me.
I thought ImageMagick could do it, but looking at the man I could not find which of the tools. - -- Cheers Carlos E. R. (from openSUSE 15.1 (Legolas)) -----BEGIN PGP SIGNATURE----- iHoEARECADoWIQQZEb51mJKK1KpcU/W1MxgcbY1H1QUCXnZ3rRwccm9iaW4ubGlz dGFzQHRlbGVmb25pY2EubmV0AAoJELUzGBxtjUfVLzEAn07lPaoowam4X9SivVdi uv5fmoLkAKCXNy2VLYRsS+hxNHbD71QHQqNizw== =ziGy -----END PGP SIGNATURE-----
Hello, On Sat, 21 Mar 2020, Carlos E. R. wrote:
El 2020-03-21 a las 16:06 -0400, Felix Miata escribió:
You can use import from ImageMagick in a script. I don't remember if I ever figured out how to determine the window ID needed, but I'm sure there's an answer to that on the web somewhere if you can't decipher the man page better than me.
I thought ImageMagick could do it, but looking at the man I could not find which of the tools.
==== trap 'exit 0' HUP INT EXIT while true; do wid=$(wmctrl -l | awk '$($NF) ~ /Firefox/ { print $0; }') date=$(date +%Y%m%d-%H%M%S) import -window "$wid" "Firefox_screenshot_${date}.png" sleep 3 done ==== Depending on the program, you'd need a bit more awk programming to find the window required. It just happens, that Firefox has that string in the last field of the window title, which is fields 5-END (aka "$($NF)") in the output of 'wmctrl -l'... HTH, -dnh -- I know I can't see sanity in the rear view mirror any more. -- stevo -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 03/21/2020 06:10 PM, David Haller wrote:
wid=$(wmctrl -l | awk '$($NF) ~ /Firefox/ { print $0; }')
Hmm dnh, Shouldn't that be { print $1 }? -- David C. Rankin, J.D.,P.E. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hello, On Sat, 21 Mar 2020, David C. Rankin wrote:
On 03/21/2020 06:10 PM, David Haller wrote:
wid=$(wmctrl -l | awk '$($NF) ~ /Firefox/ { print $0; }')
Hmm dnh,
Shouldn't that be { print $1 }?
*DOH*! Yes, of course, and also $(NF)!... The latter seemed to work though, the former was from dabbling around about the title string and not reverting to the window-id before C&P... -dnh -- Geht nicht!? Das gibt's nicht, jedenfalls nicht bei uns: Hallerlix. -- Sloganizer -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Sat, 21 Mar 2020 16:06:42 -0400, Felix Miata wrote:
Istvan Gabor composed on 2020-03-21 20:50 (UTC+0100):
I would like to make screenshots of a window at every 3 minutes. Not the full display, only one specific application window. I have KDE3 desktop. How could I write a script to do it?
I use ksnapshot manually for taking screenshots of windows. Is it possible to control it from a script?
You can use import from ImageMagick in a script. I don't remember if I ever figured out how to determine the window ID needed, but I'm sure there's an answer to that on the web somewhere if you can't decipher the man page better than me.
It seems "import" can do it nicely what I want to do. I have to play a little bit with it to find the window ID automatically and move the window to the top layer. If it's covered by some other window, the covered part becomes black area in the screenshot. Thanks Felix! Istvan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hello, On Mon, 23 Mar 2020, Istvan Gabor wrote:
It seems "import" can do it nicely what I want to do. I have to play a little bit with it to find the window ID automatically and move the window to the top layer. If it's covered by some other window, the covered part becomes black area in the screenshot.
==== screenshooter.sh ==== ### USAGE: screenshooter.sh [DELAY [APPLICATION [TITLEPATTERN]]] delay="${1:-3}" app="${2:-firefox}" pat="${3:-${app}}" trap 'exit 0' HUP INT EXIT while true; do wid=$(wmctrl -l | awk -vPAT="$pat" 'BEGIN { IGNORECASE=1; } $(NF) ~ PAT { print $1; }' ) date=$(date +%Y%m%d-%H%M%S) wmctrl -i -a "$wid" sleep 0.2 ### you can experiment with this time, no delay ### might still give you the non-raised screenshot import -window "$wid" "${app}_screenshot_${date}.png" sleep "$delay" done ==== Hm. That only matches on $NF... WIP: https://paste.opensuse.org/84118115 HTH, -dnh -- Dann siehst du nämlich ganz genau, daß der Cursor blinkt, und er hat feuerrote tote Augen, mit denen er dich anstarrt und brüllt: ".. UND WENN DU DICH VERTIPPST, DANN FRESSE ICH DICH MITSAMT DEINEM MAUSZEIGER!!!!" [Ratti in suse-programming] -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 03/21/2020 02:50 PM, Istvan Gabor wrote:
Hello:
I would like to make screenshots of a window at every 3 minutes. Not the full display, only one specific application window. I have KDE3 desktop. How could I write a script to do it?
I use ksnapshot manually for taking screenshots of windows. Is it possible to control it from a script?
Thanks,
Istvan
Both imagemagick 'import' and 'scrot' will work on KDE3 scrot --focused name.png will capture the currently focused windows -- David C. Rankin, J.D.,P.E. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (7)
-
Anton Aylward
-
Carlos E. R.
-
David C. Rankin
-
David Haller
-
Felix Miata
-
Istvan Gabor
-
Vojtěch Zeisek