Sending iMessage and Facetiming/calling using Pythonista
-
Hi,
I have a few questions:- Is possible to send imessages/sms messages using pythonista?
- Is it possible to start a Facetime Audio/Facetime/Normal call using pythonista?
- Is it possible to check if you are currently on a Facetime Audio, Facetime or Normal call?
If yes to any of the above answers, could you please link me the documentation for this. I am wanting to create some shortcuts on my iPhone 11.
-
OMZ, our developer, hasn't put fully the ability to use Pythonista with shortcuts like he wants, but my following answers are the best to my knowledge and might not be 100% correct. But I always try lol
@Nik said:
- Is possible to send imessages/sms messages using pythonista?
- Apple's Sandboxing doesn't allow Explicitly Apps to manipulate other Apps.
@Nik said:
- Is it possible to start a Facetime Audio/Facetime/Normal call using pythonista?
- Same as answer for first Question
@Nik said:
- Is it possible to check if you are currently on a Facetime Audio, Facetime or Normal call?
- If this is possible I would look into
objc_util
module. then walking up he View Tree till you find Pythonista's Main View then getting a list of the Superview's Subviews. then iterate them to find iMessage or FaceTime.
Hope this helps!
-
@Nik, please see here for URL schemes. Both messages and facetime are covered, but e.g. including the text of the message is not possible. You could have it already copied to the clipboard, though.
Use them like this:
import webbrowser webbrowser.open('sms:1234567890')
-
@Nik, using
objc_util
, you can have a custom iMessage interface where the message content is already populated, see docs here.
-
@Nik, see below for a quick Proof of concept for tracking call status. You can find the other statuses to check in the
callObserver_callChanged_
in this Apple doc. If, instead of callbacks, you just want to check that there are no ongoing calls right now, check thatlen(controller.callObserver().calls())
returns zero.import time import webbrowser from objc_util import * load_framework('CallKit') CXCallController = ObjCClass('CXCallController') CXCallObserver = ObjCClass('CXCallObserver') def callObserver_callChanged_(_self, _cmd, _obserever, _call): call = ObjCInstance(_call) if call.outgoing: print('Calling...') ObserverDelegate = create_objc_class( 'ObserverDelegate', methods=[callObserver_callChanged_], protocols=['CXCallObserverDelegate'] ) controller = CXCallController.alloc().init() retain_global(controller) delegate = ObserverDelegate.alloc().init() retain_global(delegate) controller.callObserver().setDelegate_queue_(delegate, None) time.sleep(1) webbrowser.open('facetime-audio://123456789')
-
wow this is awesome! im going to look more into this! thanks!
-
I have modified it slightly to import my login data using keychain and send an image that’s been previously copied to the clipboard. In this way, I can take a screenshot/photo, open the Photos app, copy it, and send it via email in seconds, at full-size mcdvoice login