Mac os X Screencapture loop, bash script

Here’s a simple bash script that grabs screen captures at a specified interval and saves them to files:


#!/bin/bash
# ./screencapture_loop delay_in_seconds file_name_prefix
x=1;
while :
do
  screencapture -C -m $2-`printf "%03d" $x`.png
  x=$(( $x + 1 ));
  sleep $1
done

Tags: , , ,

One Response to “Mac os X Screencapture loop, bash script”

  1. daschacka says:

    hey, thanks for the script… but i have just noticed, that after a while… like 20 screenshots in a period of 60 seconds the screencapture command just dont make the files… also when im trying to do it manually… but then like after 10 or 15minutes it works again… any idea?

Leave a Reply