๐
Script for macOS that automates desktop screenshots and video capture
On this page
When the script runs it will take a screenshot of the desktop every 30 seconds and quit after 45 screenshots. This is set by the value freq=30 and maxshots=45.
sh
#!/bin/bash# script to run screencapturescreenshot="$(which screencapture) -x -m -C"freq=30 #take a screenshot every 30 secondsmaxshots=45 #take 45 screenshots then quitwhile getopts "af:m" opt; docase $opt inf ) freq=$OPTARG; ;;m ) maxshots=$OPTARG; ;;? ) echo "Usage: $0 [-f frequency] [-m maxcaps]" >&2exit 1esacdone#set startng number; incrementally append to filenamecounter=1while [ $counter -lt $maxshots ] ; do$screenshot screenshot${counter}.jpgcounter=$(( counter + 1 ))sleep $freqdoneexit
Making screencap.sh executable
sh
chmod +x screencap.sh./screencap.sh./screencap.sh -f 8