DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Repair Spy

  • submit to reddit
        Takes a screenshot and a webcam snapshot and emails them to flickr. Requires <a href="">isightcapture</a>. Hacked up to spy on the Apple repair team as they try to repair my Mac Book Pro's backlight for the second time.

# requires isightcapture

# path to save the images

# flickr email address

# tags to attach to each picture uploaded

TIMESTAMP=`/bin/date "+%y%m%d%H%M%S"`
FRIENDLY_TIMESTAMP=`/bin/date "+%Y/%m/%d %H:%M"`

#take pics
/usr/sbin/screencapture -mxC $PATHscreen_$TIMESTAMP.png
/usr/local/bin/isightcapture -t png $PATHisight_$TIMESTAMP.png

#post to flickr
/usr/bin/uuencode $PATHscreen_$TIMESTAMP.png $PATHscreen_$TIMESTAMP.png | /usr/bin/mail -s "Repair Spy Screenshot - $FRIENDLY_TIMESTAMP tags: $TAGS" $EMAIL
/usr/bin/uuencode $PATHisight_$TIMESTAMP.png $PATHisight_$TIMESTAMP.png | /usr/bin/mail -s "Repair Spy iSight Cature - $FRIENDLY_TIMESTAMP tags: $TAGS" $EMAIL

Toss this in your crontab like so, making sure to run it as the user that you provide to the Apple Techs

*/1    *       *       *       *       default /Users/default/repair_spy >& /dev/null