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.


    Setting to define a script to directly launch if sharing extension

    Pythonista
    4
    10
    4486
    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.
    • cvp
      cvp last edited by

      Would it be possible to have a setting where we could define a particular script to run when Pythonista 3 is chosen in the sharing extension without passing by the standard Pythonista window?

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

        This is already possible - the pythonista_startup script runs in the extension too. So at the bottom of your pythonista_startup you could add something like:

        if appex.is_running_extension():
            # run appex script
        
        1 Reply Last reply Reply Quote 0
        • cvp
          cvp last edited by cvp

          I was sure I would not be clear enough with my very poor English.
          I know this script and appex etc...
          I would write an "appex mode" script which would directly run when you click the Pythonista 3 icon in the share sheet, like if my script was The app it-self.

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

            @dgelessus There's no guarantee that the app extension is launched in a new process, so the startup script may not always run. I guess you could swizzle something there to make your script run every time the extension is shown, but, to answer the original question, there's no easy/supported way to do this.

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

              Thanks to both of you

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

                Are you only allowed to expose one share sheet button per app?
                I think the question is sort of whether you could have the generic pythonista share button, as well as a PythonistaUserDefined default, which is set to run a specific script, set in settings.

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

                  Thanks to exactly clarify my question

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

                    Each app extension only has one button in the share sheet, and its icon/title is static, i.e. cannot be changed programmatically. Yes, it would theoretically be possible to include multiple app extensions in one app, but those would actually be separate binaries, and I don't think that would be worth it.

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

                      Thanks for your answer.
                      Could the other actions of the Pythonista share sheet like edit, done, scratch pad, all scripts, console be hidden to only show user icon(s) for an "end user"?

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

                        Finally, I'm really sure I wasn't clear.
                        I don't ask a second icon but that if we click the Pythonista icon an user script would be directly called without passing by the standard window
                        not this

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