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?
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:
Unfortunately I do not have this option under macOS Mojave 10.14.5
set phone_num to "mailxyz@mail.com"
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
Best 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.
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: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.