Forum Archive

Returning to calling app after URL scheme call

halloleo235

Hi there

I have a script doing some text conversion in the clipboard. I call the script via the pythonista:// URL scheme.

After running the script from say iCabMobile or Drafts, ptyhonista stays open, but I would like automatically to return to the calling app. How is this possible?

Many thanks, Leo

userista

You can use the webbrowser module to open a url (including url schemes).
Though I don't think you're able to see which was the calling app (iOS limitation) to dynamically call that app.

JonB

I think you are looking for something like this?

halloleo235

@hyshai, @JonB: Not sure if I understand the x-callback-url scheme properly, but I hoped that a x-source parameter would do it. I guess I have to implement that in pythonista myself...

JonB

You can pass arguments to pythonista using args, or argv parameters.

So while pythonista does not directly support x-callback-url directly, you can do everything you want with arguments. So, you could pass the source, or callback url, etc as arguments to your functions. You could one for success, or for failure, etc. of course, if you only have one app that needs the function, it may be easier to hardcode in the script.

See
urlscheme in the docs.