n seconds
On windows, we can use nircmd
to take screenshots periodically and save them using batch script that looks like the
following script screenshot.bat.
Here we take a screenshot every 150 seconds (2.5 minutes)
and save it to Downloads\screenshots folder with timestamp as screenshot filename.
@echo off
setlocal
:repeat
nircmd.exe savescreenshotfull c:\Users\i523429\Downloads\screenshots\~$currdate.MM_dd_yyyy$-~$currtime.HH_mm_ss$.png
timeout /t 150 /nobreak > NUL
goto :repeat
To run the above script on startup, we can add the the above batchscript
to windows startup folder. We can press WINDOWS_KEY + R and
run shell:startup, this will take you to startup folder with path
that looks like C:\Users\i523429\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Similarly, on linux we can use scrot.
screenshot.sh
#!/usr/bin/bash
while true
do
dir1=`readlink -f ~/Downloads`
folder="$dir1/screenshots/$(date +%Y-%m-%d)"
mkdir -p $folder
file="$(date +%Y-%m-%d-%H%M%S).png"
scrot "$folder/$file"
sleep 150
done
To run the above script on login, we can add the the above bash file to
/etc/profile.d/
sudo ln -s /home/jagadeesha/screenshot.sh /etc/profile.d/screenshot.sh
OR
you can bash file to $HOME/.profile.
On Mac, we use the system utility called screencapture.
If we have multiple displays connected, we can store each display content in a seperate image.
I currently do not know if there is flag for screencapture to make all the content to capture in a single image.
#!/usr/bin/bash
while true
do
dir1="/Users/I523429/Downloads"
folder="$dir1/screenshots/$(date +%Y-%m-%d)"
mkdir -p $folder
num_displays=$(system_profiler SPDisplaysDataType | grep -c Resolution)
for i in $(seq 1 $num_displays)
do
file="$(date +%Y-%m-%d-%H%M%S)_$i.png"
screencapture -x -D $i "$folder/$file"
done
sleep 150
done