Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Snap and upload iSight pictures on wake from sleep' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Snap and upload iSight pictures on wake from sleep
Authored by: edwilde on Jun 06, '09 07:52:54AM

Ok, so when I found this hint half the links didn't work. So I did a bit of digging for the greater good, as I still haven't found a good free application which provides the same functionality. I have just set this up on my unibody macbook (running 10.5.7) and it works like a charm.

Updated links (June 2009):

The full shell script (recovered from Google Cache)

#!/bin/bash
#
# iSight Auto Upload Script - by Dylan O'Donnell 2006
#####################################################
# Edit CAPITALS with appropriate details
# Notes : Change file path to a folder without other JPEGs
# : IF you get zero-byte files, try removing the "passive" line from the FTP stuff.
#
#####################################################

# Generate filename based on date stamp
date=$(date +%m%d%y%H%M%S).jpg;

# Take iSight Photo and store in /tmp with datestamp filename
/bin/isightcapture -w 640 -h 480 -t jpg /Users/USERACCOUNT/Documents/$date;

# Wait a little while, if Mac is waking from sleep, needs a moment to connect to network
sleep 60;

# Generate semaphore for connectivity by pinging NASA
isconnected=$(ping -c 1 www.nasa.gov | grep 64 | wc | awk '{print $1}');

# If connected...
if [ "$isconnected" -eq "1" ]; then

# Make .netrc FTP session commands on the fly
cat > ~/.netrc machine WWW.YOURWEBSITE.COM
login USERNAME
password PASS
macdef init
lcd /Users/USERACCOUNT/Documents
cd REMOTE/DIR
passive
prompt
restrict
type binary
prompt
mput *.jpg
quit

EOF

# Run FTP session to put JPGs in webspace, then delete from /tmp
chmod 600 ~/.netrc
ftp -i WWW.YOURWEBSITE.COM
rm /Users/USERACCOUNT/Documents/*.jpg

else
# If not connected.. leave captures there until next time.
echo "No Connection, Image not transferred or deleted.";
fi

You may also want to make a startup item to call this script, since this will only fire if the computer wakes from sleep not from power off.

I cheated and used applescript do shell script "~/.wakeup &" ;)



[ Reply to This | # ]
Snap and upload iSight pictures on wake from sleep
Authored by: tompohl on Jan 24, '10 01:14:53PM
Under OSX 10.5 and 10.6 a non-interractive user script (like sleepwatcher) isn't allowed access to the camera anymore. I've posted a simple tutorial how to get around that limitation! HOWTO: Track your mac

[ Reply to This | # ]