How To Use FaceTime For Home Surveillance

Really simple for keeping an eye on your living room, all you need is a Mac and this AppleScript.

It certainly won't alert you to intruders in your house, but if you want to make sure your cat hasn't gotten into a fight with the dog, you can easily access your webcam from your iOS device with FaceTime. Just copy and paste the following AppleScript into AppleScript editor and save it as an Application. Now, whenever you leave the house, just run the application and it will monitor for new FaceTime calls.

When you want to check in on your living room, just call yourself on FaceTime from your iPhone or iPod touch, and your Mac will automatically answer the call. When you hang up the call, the script will close FaceTime and continue monitoring for incoming calls. When you get home, you can just quit the app to stop FaceTime from auto-answering everything that comes in.


-- Facetime Auto Answer
-- Copyright ©2010 CornDog Computers
-- twitter: @CornDoggyRob

repeat
        -- Check to see if Facetime is active
        tell application "System Events" to set theCount to the count of (processes whose name is "Facetime")
        if theCount = 0 then
                do shell script "sleep 1"
        else
                tell application "FaceTime" to activate
                do shell script "sleep 2"
                tell application "FaceTime" to activate
                tell application "System Events" to tell process "FaceTime"
                        if name of front window contains "with" then
                                do shell script "sleep 5"
                        else
                                tell application "System Events" to activate application "FaceTime"
                                keystroke return
                                do shell script "sleep 5"
                                -- Check to see if call is active
                                tell application "System Events" to tell process "FaceTime"
                                        if name of front window contains "with" then
                                                do shell script "sleep 5"
                                        else
                                                -- Quit Facetime if call is not active
                                                tell application "FaceTime" to quit
                                                do shell script "sleep 5"
                                        end if
                                end tell
                        end if
                end tell
        end if
end repeat
end


IMPORTANT: You'll want to make sure that you have your Mac set to use an email address that no one else knows you use for FaceTime, otherwise it will auto-answer anyone that calls it. Unless, that is, you are setting up a kitty-cam and giving the address to all of your friends for afternoon entertainment.

Update: It seems you need access to assistive devices enabled for this to work. If you get an error when running the script to that effect, head over to System Preferences > Universal Access and check the "Enable Access for Assistive Devices" checkbox at the bottom of the preference pane.

No comments:

Post a Comment