Page 1 of 1

Make a facetime Call

PostPosted: Fri Mar 04, 2016 2:56 pm
by artpics
i want to use the below code which i came across, so when my DSC alarm is triggered it makes a FaceTime call to me. everything seems to work but this line does not complete any help would make me happy. :D

thanks
just paste the code below into your script editor

-- simulate pressing the Enter key
tell application "System Events"
keystroke return


Code: Select all
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

Re: Make a facetime Call

PostPosted: Fri Mar 04, 2016 3:25 pm
by peteinau
Hi,

The return key won't actually connect the FaceTime call, you need the following code:

tell application "System Events"
repeat while not (button "Call" of window 1 of application process "FaceTime" exists)
delay 1
end repeat
click button "Call" of window 1 of application process "FaceTime"
end tell

Which will click the actual call button. You will need to make sure that you have Accessibility turned on for the app you are running it from tho otherwise it will still fail.

Re: Make a facetime Call

PostPosted: Fri Mar 04, 2016 6:54 pm
by artpics
thanks it rings :shock: will do some more testing later

Re: Make a facetime Call

PostPosted: Sat Mar 05, 2016 2:36 pm
by artpics
EDIT:
for mac minis no camera you have to change the first line to this.

Code: Select all

open location "facetime-audio://" & "change to your phone number" & "?audio=yes"



:D

Re: Make a facetime Call

PostPosted: Thu Jun 29, 2017 12:01 am
by MarcoGT
peteinau wrote:
Hi,

The return key won't actually connect the FaceTime call, you need the following code:

tell application "System Events"
repeat while not (button "Call" of window 1 of application process "FaceTime" exists)
delay 1
end repeat
click button "Call" of window 1 of application process "FaceTime"
end tell

Which will click the actual call button. You will need to make sure that you have Accessibility turned on for the app you are running it from tho otherwise it will still fail.


I am trying to bring it inside Indigo, but I do not understand where this part of code goes into.
Into which "tell application "System Events" shall it go?

Would it be possible to have the complete code?

Thanks
Marco