Had a bit of an issue, thought it was worth a post, first in a while…
howto make mac osx automatically take timed screenshots every X seconds with a simple bash script
For programmers, open terminal
for i in {1..9999}; do echo “taking screen shot $i”; screencapture -x “helloworld$i.png”; sleep 1; done
For Editorial
Open Terminal
- Open finder
- go to the “Applications” Folder
- go inside the “Utilities” Folder
- run the “Terminal” application
Run the wee script which does the magic
- Go to the “Terminal” application
- type “cd”
- type a space
- Go to finder,
- open a folder you what the screen captures to happen in
- drag the icon of the folder into the “Terminal” application (this should make some text appear in the Terminal app like /Data/Applications or something)
- Go back to the “Terminal” application
- type return
- type ‘for i in {1..9999}; do echo “taking screen shot $i”; screencapture -x “helloworld$i.png”; sleep 1; done‘ exact character for character or copy and paste
- type return
- {at this point the computer should be taking screen shot every second}
- Do stuff, what ever you want to capture
- When you want to stop the capturing, simply quite “Terminal” the way you normally would
Improvements
- sleep 1, controls the time between captures, so sleep 60 would take a capture every minute
- {1..9999}, controls the amount of time, that means after 9999 loops it stops
my good friend dimitar has suggested a better loop which never stops unless stopped by the user
#! /usr/bin/env bash
i=0
while 1
do
((i++))
screencapture -T 1 “capture$i.jpg”
done