TransWikia.com

Auto FaceTime call using AppleScript, without confirmation

Ask Different Asked by D0doooh on December 24, 2021

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

One Answer

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.

Answered by user3439894 on December 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP