Created
December 10, 2014 06:53
-
-
Save jasmas/30ea8c3051f5529cf910 to your computer and use it in GitHub Desktop.
ToSafari.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Receives a URL via JS bookmarklet and sends it to Safari | |
# Bookmarklet: javascript:window.location='pythonista://ToSafari?action=run&argv='+encodeURIComponent(document.location.href); | |
# Assumes script is in the root of Pythonista and called 'ToSafari' | |
import sys | |
import webbrowser | |
numArgs = len(sys.argv) | |
if numArgs < 2: | |
print 'No URL was received' | |
else: | |
url = sys.argv[1] | |
webbrowser.open('safari-' + url) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment