omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Sending iMessage and Facetiming/calling using Pythonista

    Pythonista
    5
    8
    3643
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Nik
      Nik last edited by Nik

      Hi,
      I have a few questions:

      1. Is possible to send imessages/sms messages using pythonista?
      2. Is it possible to start a Facetime Audio/Facetime/Normal call using pythonista?
      3. 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.

      stephen mikael 4 Replies Last reply Reply Quote 0
      • stephen
        stephen @Nik last edited by

        @Nik

        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:

        1. Is possible to send imessages/sms messages using pythonista?
        • Apple's Sandboxing doesn't allow Explicitly Apps to manipulate other Apps.

        @Nik said:

        1. Is it possible to start a Facetime Audio/Facetime/Normal call using pythonista?
        • Same as answer for first Question

        @Nik said:

        1. 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!

        1 Reply Last reply Reply Quote 0
        • mikael
          mikael @Nik last edited by mikael

          @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')
          
          1 Reply Last reply Reply Quote 1
          • mikael
            mikael @Nik last edited by

            @Nik, using objc_util, you can have a custom iMessage interface where the message content is already populated, see docs here.

            1 Reply Last reply Reply Quote 2
            • mikael
              mikael @Nik last edited by

              @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 that len(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')
              
              stephen 1 Reply Last reply Reply Quote 1
              • stephen
                stephen @mikael last edited by

                @mikael

                wow this is awesome! im going to look more into this! thanks!

                1 Reply Last reply Reply Quote 0
                • Crouch
                  Crouch last edited by Crouch

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • pipahaha
                    pipahaha last edited by

                    This post is deleted!
                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    Powered by NodeBB Forums | Contributors