Among its many benefits, the holidays compel us to visit friends and relatives who may live more than a short drive away. But during our time away we sometimes want to keep tabs on things on the home front. For example, with the office closed up and heat turned down, is your beloved ficus freezing? Or have the cats destroyed your home in between visits from the sitter? With a Mac configured correctly and Automator’s help you can keep tabs on things while you’re away.
A camera, an iCloud account, and a little know how
On a Mac that has a built-in FaceTime camera (or attached webcam) create a folder on the desktop and call it Shots. Launch iPhoto, choose iPhoto > Preferences, select the iCloud preference, and enable the My Photo Stream option. (You must have an iCloud account for this to work.)
Launch Automator and, from the workflow chooser, select Workflow. In the Action pane select Photos and drag the Take Video Snapshot to the workflow area. Enable the Take a picture automatically option in this action and then drag the Shots folder you created to its Where pop-up menu.
From this same Photos library drag the Change Types of Images action to the workflow area. From the To Type pop-up menu choose JPEG.
Yet again, from the Photos library, drag the Import Files into iPhoto action to the workflow area. Configure the first pop-up menu to read Existing Album and the second to read My Photo Stream.
Save your workflow as SnapShot.workflow (adding the workflow extension is necessary). Save the workflow to youruserfolder/Library/Workflows. (If the Workflows folder doesn’t exist, create one.)
What’s happened so far: When this workflow runs your Mac takes a picture of whatever it’s pointing at—your ficus or the cat bowls or the weather outside. It then adds that picture to your Photo Stream album. The images in that album are automatically uploaded to iCloud where you can view them in the Photos app on your iPhone, iPod touch, or iPad.
Applescript makes the magic
But we’re not done yet. And we aren’t because we want this workflow to trigger repeatedly while we’re gone. One way to achieve this is to create a Calendar Alarm workflow. The problem with such a workflow is that you can repeat a calendar alarm just once a day. We’d like something that repeats every hour. The secret to doing that is AppleScript.
Launch AppleScript Editor (found in /Applications/Utilities) and paste in this script:
property secondsBetweenRuns : 3600
property workflowFileName : “SnapShot.workflow”
— get the path to the Automator workflow file stored in the user Workflows folder
set the workflowsFolderPath to the POSIX path of (path to workflows folder)
set the targetWorkflowPath to workflowsFolderPath & workflowFileName
— run the workflow
do shell script “automator” & space & quoted form of the targetWorkflowPath
Save this script as an application. When doing that make sure that in the Save dialog box you’ve enabled the Stay open after run handler option. Launch it when you want your Mac to start taking pictures. To quit it, locate it in the Dock, click on it, and choose Quit.
This AppleScript is our timer. The first line—property secondsBetweenRuns : 3600—initiates our workflow once an hour (or every 3600 seconds). If you wanted your workflow to snap a picture every minute, you’d change 3600 to 60. This is an AppleScript that you’ll want to keep around for triggering other workflows more than once a day. All you need to alter is the number of seconds it triggers and the name of the workflow it points to.
An awake Mac is an alert Mac
For this scheme to work, your Mac must be logged into your account and active. You can put the display to sleep, but not the Mac itself. This is easily done by traveling to System Preferences, choosing the Energy Saver preference, and pushing the Computer Sleep slider all the way to the right (where it reads Never).