-
Notifications
You must be signed in to change notification settings - Fork 2
/
utils.sh
31 lines (28 loc) · 999 Bytes
/
utils.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
# create screnshots of NIFs with nifskope
find . -iname "*.nif" | while read f;
do
echo ${f};
DIR=album/$(dirname "${f}")
echo ${DIR}
mkdir -p "$DIR" # create directories
nifskope "${f}"& sleep 3; # open nifskope with NIF
wmctrl -c nifskope; sleep 2; # close the PNG ICCC warning window
wmctrl -a nifskope; # raise nifskope to top
gnome-screenshot -w -d 1 -f "album/${f}.png" # screenshot top window
wmctrl -c nifskope; wmctrl -c nifskope; # close any open nifskope windows
done
# find any screenshots that are incorrect and try to retake them
find ./album -name '*.png' -exec file {} \; | sed 's/\(.*png\): .* \([0-9]* x [0-9]*\).*/\2 \1/' | awk 'int($1) == 1202 {print}' | while read f;
do
f=${f:19:-4}
echo ${f};
DIR=album/$(dirname "${f}")
echo ${DIR}
mkdir -p "$DIR"
nifskope "${f}"& sleep 3;
wmctrl -c nifskope; sleep 2;
wmctrl -a nifskope;
gnome-screenshot -w -d 1 -f "album/${f}.png"
wmctrl -c nifskope; wmctrl -c nifskope;
done