[b]I am trying to write a applescript for a interactive iPhone doorbell camera
(Here is a demo)
http://www.youtube.com/watch?v=ZJQeecOJUFs
I have it, when it launches the script, it calls my iPhone via facetime
if I doesn’t answer after 35 seconds, it disconnects and quits facetime and ends the program
if I do answer the call it keeps the connection active (I can’t figure out how to make it watch for inactivity and quit facetime, but the program still quits)
ultimately I would like the program to be able to call me, when its triggered, but also wait for a call so if I miss the call I can ‘call it back’[/b]
Here is the code I have so far
open location “facetime://12345678”
delay 5
– simulate pressing the Enter key
tell application “System Events”
keystroke return
– 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
– sets how long facetime will ring your phone (40 secs)
do shell script “sleep 40”
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 1”
– if call is active wait 60 seconds before rechecking
else
– Check to see if call is still active
tell application “System Events” to tell process “FaceTime”
if name of front window contains “with” then
do shell script “sleep 1”
else
– Quit Facetime if call is not active
if name of front window contains “facetime” then
tell application “FaceTime” to quit
do shell script “sleep 1”
end if
end if
end tell
end if
end tell
end if
end tell
Here is a program that will 'watch the connection and auto answer incoming face time requests:
– 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
[b]
Anyone have any ideas?
Thanks!
Jonathan[/b]