Forum Archive

Send URL from extension to Editorial.app

simple

I want to send a URL from an extension to a document in Editorial.app. When I run the script in pythonista it works, but if I run it from the extension it doesn't.

import appex
import requests
import webbrowser
import clipboard
import console

def main():
if not appex.is_running_extension():
url = "www.example.com"
else:
url = appex.get_url()

if url:
clipboard.set(url)
# Editorial.app will use the clipboard and paste it at the end of a document
webbrowser.open('editorial://x-callback-url/open/path-to-file.txt?root=dropbox&command=PasteLink&x-success=pythonista://')
else:
print 'No input URL found.'

if __name__ == '__main__':
main()

I tested it a bit more and it seems that the webbrowser.open() doesn't work in the extension. Is there a other solution to send the URL?

Webmaster4o

This is an apple restriction. Use:

```python
from objc_util import *

app=UIApplication.sharedApplication()
url=nsurl('editorial://')
app.openURL(url)

simple

Thanks, didn't know that. It now works!