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.


    Launching Pythonista from 1.6b app extension

    Pythonista
    2
    3
    2407
    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.
    • fraserspeirs
      fraserspeirs last edited by

      I'm trying to write a script for the 1.6 app extension that will:

      • Take some text passed in from the share sheet
      • Format the text in a specific way
      • Place the formatted text on the pasteboard
      • Launch Pythonista and run another script that will take the text on the pasteboard and do something with it.

      Here's the script:

      import appex
      import clipboard
      import webbrowser 
      
      initial_text = appex.get_text()
      
      # text processing stuff
      
      clipboard.set(processed_text)
      webbrowser.open('pythonista://NewFromClipboard.py')
      

      Is it possible to launch a pythonista:// URL from the app extension? If not, is it possible to do something with objc_util?

      Worst case, I can make it a two-step process but it would be great to have it in one place.

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

        As far as I'm aware, this is unfortunately impossible. The API that is supposed to open URLs from app extensions is explicitly documented as only being available for Today widgets, the regular one (via UIApplication) doesn't do anything either in an extension.

        In earlier versions of iOS 8, there was a workaround for this (essentially abusing a web view), but this has apparently been patched in 8.4.

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

          Thanks. It's not a huge big deal to make it a two-step process. Just glad to know I shouldn't spend any more time on this.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors