Have you ever been away from your Mac, then come back only to find that your co-worker has stolen your favorite Apple pen? Well, I am going to show you how to catch them in the act by creating a Mac "spy cam." For this how-to, you will need to create an Automator workflow, AppleScript, and some Mail rules. So, cue the James Bond music, and let's begin.
Continue reading to learn how to create the Mac spy cam.
Creating the Automator workflow
Let's first create the Automator workflow; this will take the picture and e-mail it to you. To create this workflow, just place the following Automator actions together (in the same order):
- Take Video Snapshot
- New Mail Message
- Send Outgoing Messages

Let's save the Automator workflow somewhere where you can find it later (for instance, you may want to create an "Automator" directory in your Documents directory). In Automator, click File > Save, select "Application" from the "Format" drop down box; type a file name, then click save.
Creating the AppleScript
This is going to be an extremely simple AppleScript, since Mail.app will open via the Automator action and that's about all we need. Open the Script Editor.app (found in ~/Applications/AppleScript/ ). Paste the following script into the editor (if you saved your Automator workflow as a different name, replace the "Take Pictures and E-mail" to the name of your saved workflow).
tell application "Take Picture and E-mail" to launch

Creating the mail rules
To link all the parts together, let's create the Mail rules. Open Mail.app's preferences (command + , ) then click Rules. Click the "Add Rule" button. Type a description and select "All" for the "If ALL of the following conditions are met."
Now let's add the conditions (you will have to click the plus sign to add more conditions):
- From ... Contains ... you@youremail.com
- Subject ... Is Equal To ... System&*Pic
- Message Content ... Contains ... Picture
- Set Color ... of Background ... Blue
- Run AppleScript ...
Running the Script
To run the script, all you need to do is send an e-mail from the account specified with "System&*Pic" in the subject line, and "Picture" in the body of your message.
Additional Information
- Please note that scripts such as these may be used against you by: co-workers, roommates, friends, crazy monkeys, and people on Digg
- By changing the subject line condition to be a "password," you will decrease the likeliness that #1 will happen
- You can include unusual characters for message content conditions (i.e. #, @, or ^) in order to avoid accidentally running a script that you didn't want (for example use: #shutdown# instead of just shutdown)
- It is also a good idea to have Mail.app check for new messages often for this to work well











Reader Comments (Page 1 of 1)
4-22-2008 @ 9:43AM
Krest said...
It should be possible to do the whole thing with AppleScript without the detour via Automator. I did a script a while ago that took a screenshot and mailed it triggered by an email. Got a tutorial on that (german only, sorry) but you might be able to get the idea. http://www.kressline.de/stuff/c4d_status.html
Reply
4-22-2008 @ 10:05AM
meatleg said...
the bad thing about this automator action for "Take Video Snapshot" is that the image is very small. I made my own version of this about a week agon and i used this shell script found here to take a 640x480 image:
http://www.intergalactic.de/pages/iSight.html
i also added an action to open the image in preview and rotate it 90º because it will display on my phone better that way. then it auto sends the file to the trash after it is sent so no evidence is left behind... fun fun fun
Reply
4-22-2008 @ 10:27AM
Scott V said...
My cousin stole my favorite Apple Pen... And i only had it for three days too :(
Reply
4-22-2008 @ 11:14AM
brian said...
Yes, it is. I'm talking about taking a screenshot (like when you press shift-command-3), not a picture with the camera.
4-22-2008 @ 10:33AM
brian said...
This is neat (and I'm a huge believer in making your own tools, even if you're reinventing the wheel--it's a great way to learn) but what I really want is a way to remotely trigger a screenshot. The built-in 'screencapture' command-line utility no longer works unless you run it from a locally-spawned Terminal session. I used to have it in 'crontab' to run every minute on my own machine as a security measure, and I have a web-based front-end for it running on some computers in some conference rooms I manage. (Reply if you want the script.) Worked fine in 10.3 and 10.4; doesn't in 10.5--not even when run as root. I can create an Automator action that takes a screenshot but when you run that the icon appears in the Dock and I'd rather have this run totally invisibly.
Reply
4-22-2008 @ 10:38AM
meatleg said...
brian - is it different from the shellscript that i listed in my last comment?
4-22-2008 @ 5:03PM
brian said...
(Oops, replied to the wrong one.) We're two different things. I'm talking about taking a picture of the screen itself (a screenshot, like when you press shift-command-3), not taking a picture of the user with the camera.
4-22-2008 @ 10:47AM
Andrew said...
Or - just install Skype, create 2 accounts and have it auto answer when the other account calls - and enable 'start video' on calls from contacts in my address book.
Full Motion HD Video (on a new Mac) with 2way voice..
Reply
4-22-2008 @ 11:04AM
psxp said...
hey, is there software / script to take a snapshot photo every 5 mins and say FTP or email ?
that would be handy.
Reply
4-22-2008 @ 11:40AM
nab said...
I use a program called EvoCam it has lots of options dealing with the isight camera, I have it set to detect motion then it can upload it to a FTP site or email to you.
Reply
4-22-2008 @ 12:28PM
Ryan Trevisol said...
Hate to be a nitpicker but Script Editor is not found in ~/Apps. That would be /Users/xxxxx/Apps. It's in /Applications.
Reply
4-22-2008 @ 12:31PM
badtzmaru said...
Wait wait, people use Macs at work?
Reply
4-22-2008 @ 1:16PM
Ryan Trevisol said...
Hehe . . . yes we do, actually I'm thinking about setting this up for my wife (a teacher) to catch custodians stealing stuff from her classroom at night.
4-22-2008 @ 12:32PM
mark said...
any one no of a program like evo cam but that is is free?
Reply
4-22-2008 @ 2:47PM
lane said...
I highly doubt you'll find anything free if you want any decent options that is. EvoCam is well worth it, they do their best to support cameras of all kinds.
2¢
Faslane
4-22-2008 @ 3:06PM
neckaros said...
A lot easier and silent (no app opening just the green LED)
isightcapture for Leopard: http://scriptbuilders.net/files/isightcapture1.1.html
Create the folder "Terminal" in your home directory. Put isightcapture in it.
Create an apple script with this text and don't forget to replace "MY@MAIL.COM by your own eMail adress.
do shell script "~/Terminal/isightcapture ~/Terminal/snappit.jpg ; uuencode ~/Terminal/snappit.jpg snappit.jpg | mail -s CamPic MY@EMAIL.COM ; mv ~/Terminal/snappit.jpg ~/Terminal/`date +%y%m%d%H%M%S`.jpg"
(gMail webmail as problem reading the image but Mail.app do it just fine)
Reply
4-23-2008 @ 12:54AM
Designr said...
Or.... you could buy a copy of SecuritySpy (securityspy.com) and watch live video on your iPhone, capture video and snapshots triggered by customizable motion detection, automatically upload same to an ftp site and automatically email your boss video of your co-worker swiping your pen.
Reply
5-02-2008 @ 1:48AM
Adam Jenkins said...
When I do this workflow, it does not send a picture, it send a place holder but not image
Reply