This guide will detail how to set up a script to silently record screenshots of a user's activities.
First, download both attached files onto the mac for which you'd like to apply this script
1. Create directory in which screencaps will be stored. For this tutorial we will be using "/Library/Screencaps/" which is a folder that needs to be created.
The following code is the contents of the auto-capture.scpt file (see attached) which needs to be put in the created folder "/Library/Screencaps/"
If adjustments need to be made to timing, modify both the delay and the repeat count
set dFolder to "~/Library/Screencaps/" do shell script ("mkdir -p " & dFolder) repeat 900 times -- Repeat 900 times. for 75 hours set dateTime to do shell script "date +%Y%m%d_%H%M%S" do shell script ("screencapture " & dFolder & dateTime & ".png") -- Capture screen. delay 300 -- Wait for 5 mins end repeat
2. Put screencap.plist in "/Library/LaunchAgents/"
The following code is the contents of screencap.plist
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>screencap.job</string> <key>ProgramArguments</key> <array> <string>/usr/bin/osascript</string> <string>/Library/Screencaps/auto-capture.scpt</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist>
3. Open Terminal and type
sudo chown root /Library/LaunchAgents/screencap.plist
This will set permissions correctly on the screencap.plist file so that the script can be autostarted
4. In Terminal run
launchctl load -w ~/Library/LaunchAgents/screencap.plist
This will add the .plist file to the launch daemon
On next login screenshots will be silently captured and put into /Library/Screencaps/ every 5 minutes for 80 hours continuously.
When we want to remove the script from running use the following
launchctl unload -w ~/Library/LaunchAgents/screencap.plist