Discussion:
script for making screenshots
(too old to reply)
Felix Miata
2020-03-21 20:06:42 UTC
Permalink
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+***@opensuse.org
To contact the owner, e-mail: opensuse+***@opensuse.org
Vojtěch Zeisek
2020-03-21 20:00:02 UTC
Permalink
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/
Vojtěch Zeisek
2020-03-21 20:21:01 UTC
Permalink
Post by Vojtěch Zeisek
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/
David Haller
2020-03-21 23:10:11 UTC
Permalink
Hello,
Post by Felix Miata
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+***@opensuse.org
To contact the owner, e-mail: opensuse+***@opensuse.org
David C. Rankin
2020-03-22 04:26:13 UTC
Permalink
Post by David Haller
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+***@opensuse.org
To contact the owner, e-mail: opensuse+***@opensuse.org
Loading...