3 ms·
> Is there some software (macos) to regularly create screenshots throughout the day? On macOS here's a little shell command to take a screenshot every 60 secon
by varenc 4y ago
> Is there some software (macos) to regularly create screenshots throughout the day?
On macOS here's a little shell command to take a screenshot every 60 seconds and place it in the /tmp folder:
while true; do
screencapture /tmp/screen_capture_$(date +\%s).jpg ;
echo "wrote screenshot";
sleep 60;
done
You can also include the name of the front most application by fetching it with AppleScript and then putting that in the filename. (Or you could put different app screenshots in different folders)
while true; do
FRONT_APP=$(osascript -e 'tell application "System Events" to name of first application process whose frontmost is true');
screencapture /tmp/screen_capture_${FRONT_APP}_$(date +\%s).jpg ;
echo "wrote screenshot";
sleep 60;
done
Of course if you want this to run long term, use a cron job or even better, a launchd job. With launchd you get better coalescing and sleep recovery behavior. You can also add other fun trigger events. Like take a screenshot every time your `.zshrc` is modified [0]. Or a screenshot every time your internet access changes (by triggering on /etc/resolv.conf)
[0] Look up `WatchPaths` on my favorite launchd guide here: https://launchd.info/ https://launchd.info/