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.
Use x-callback-urls with Pythonista
-
I don't know if this is technically possible, but I think its a great idea. There are many apps in the App Store that implement a concept of inter-app-communication called x-callback-url. This allows some really advanced automation.
The basic idea is that app1 launches app2 with a url scheme that follows the x-callback-url specification. This means that, in addition to the parameters, it twice adds its own url scheme, one time for success callback and once for error.
This would need to be implemented by Pythonista, as the
UIApplication -openURL: options:
method in theAppDelegate
gets called. However, Pythonista could parse any parameters passed into a dictionary and return it from thewebbrowser.openURL
method.Example:
- Launch Drafts with an url scheme and get the contents of a specific note
drafts4://x-callback-url/get?uuid=UUID-TO-VALID-DRAFT&x-success=YOUR_APP_URL_SCHEME://success
Drafts will fetch the contents of the note and call the x-success url you provided, with atext
parameter containing the contents of that note
- Launch Drafts with an url scheme and get the contents of a specific note
-
this can be done and has been done. see for example
https://www.macstories.net/stories/automating-ios-how-pythonista-changed-my-workflow/you can just use webbrowser.open, no need for objc.
pythonista doesn't accept x-callback-urls directly, but the script you run from the pythonista url scheme can take a callback arguments. pythonista can, of course call other apps with callbacks, either using pythonista:// (there are a few posts about detecting when the app returns to the foreground), or using the url scheme to run a continuation script.
-