2

I would like to automate a FaceTime call without having to confirm the call in the FaceTime app. Is there a way to do that?

EDIT:
Call message

When I execute the script I get this message in the upper right corner. I would like to bypass this message so that the call starts automatically.

EDIT2:

enter image description here Unfortunately I do not have this option under macOS Mojave 10.14.5

set phone_num to "[email protected]"
do shell script "open facetime://" & quoted form of phone_num
tell application "System Events"
    repeat until (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
3
  • I added a screenshot to the question. I would like to avoid this message.
    – D0doooh
    Jul 4, 2019 at 9:17
  • 1
    As I previous said, your code, with my info, works for me without issue; however, I'm running it on macOS High Sierra. If with macOS Mojave in FaceTime > Preferences… there is no setting to bypass the Notification Center confirmation, then you'll just have to add the extra AppleScript code to click Call on it. Jul 4, 2019 at 13:00
  • unfortunately it does not work under mac OS Mojave and there is no function like this. Do you have an idea how to integrate this into the script? Or I just downgrade back to High Sierra. but I'd like to stay on Mojave.
    – D0doooh
    Jul 4, 2019 at 13:29

1 Answer 1

2

In macOS High Sierra the Call button in directly on the face of the FaceTime window and why click button "Call" of window 1 of application process "FaceTime" works.

Is this true for macOS Mojave too, and then when that button is clicked one also gets the Notification Center Alert, or when placing the call it only shows the Notification Center Alert with the Call button on it?

The following example AppleScript code will wait for Notification Center to display a window and click the Call button, assuming it has one.

tell application "System Events"
    repeat until (exists window 1 of application process "Notification Center")
        delay 0.1
    end repeat
    click button "Call" of window 1 of application process "Notification Center"
end tell

Obviously this does not take into account if there is more then one notification, say if one existed prior to the call being made and had not yet been dismissed. In that scenario, additional coding will be necessary to target the specific notification.

Update: After some additional testing, under macOS High Sierra, the previous paragraph may be an unnecessary statement if the result are the same under macOS Mojave. The testing revealed that if a notification is present when another one is displayed, then the latest notification displayed is placed at the top of the window list in Notification Center and is then window 1. In that case, the following example AppleScript code may work for you:

set phone_num to "[email protected]"
do shell script "open facetime://" & quoted form of phone_num
tell application "System Events"
    repeat until (exists window 1 of application process "Notification Center")
        delay 0.1
    end repeat
    click button "Call" of window 1 of application process "Notification Center"
end tell
  • This example code assumes in macOS Mojave when placing the call, in this manner, it only shows the Notification Center Alert with the Call button on it.

Note: The example AppleScript code is just that and does not contain any error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors.

2
  • Thank you very much times, this works for me. :) best regards D0doooh
    – D0doooh
    Jul 6, 2019 at 12:52
  • This worked for me on Catalina if I used the tel:// scheme instead. The facetime:// scheme opens a window of its own application with nothing in Notification Center. Jul 23, 2020 at 20:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .