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
-
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?
-
This is already possible - the
pythonista_startup
script runs in the extension too. So at the bottom of yourpythonista_startup
you could add something like:if appex.is_running_extension(): # run appex script
-
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. -
@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.
-
Thanks to both of you
-
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. -
Thanks to exactly clarify my question
-
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.
-
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"? -
Finally, I'm really sure I wasn't clear.
I don't ask a second icon but that if we click thean user script would be directly called without passing by the standard window