Skip to content

Instantly share code, notes, and snippets.

@ykrkn
Created January 9, 2019 11:08
Show Gist options
  • Save ykrkn/0923e0f9af32e1d5258d6cad8d21d578 to your computer and use it in GitHub Desktop.
Save ykrkn/0923e0f9af32e1d5258d6cad8d21d578 to your computer and use it in GitHub Desktop.
mac os x launch agent for screen capture
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.ykrkn.screencapture</string>
<key>UserName</key>
<string>sx</string>
<key>WorkingDirectory</key>
<string>/Users/yurykrikun/Documents/screencapture</string>
<key>Program</key>
<string>/Users/yurykrikun/Documents/screencapture/doit</string>
<key>StartInterval</key>
<integer>60</integer>
</dict>
</plist>
#!/usr/bin/env bash
DATE=$(date +%Y%m%d)
CDIR=$(pwd)
TIME=$(date +%H%M%S)
FILE="$CDIR/$DATE/$DATE$TIME.png"
if [ ! -d "$CDIR/$DATE" ]; then
mkdir "$CDIR/$DATE"
fi
echo "$FILE"
screencapture "$FILE"
/Users/yurykrikun/Documents/screencapture/doit
cd ~/Library/LaunchAgents
launchctl load com.ykrkn.screencapture.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment