Advertisement
n8henrie

Import Pythonista Script from Bookmarklet

Feb 21st, 2013
1,813
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. # Posted at http://n8henrie.com/2013/02/quickly-import-pythonista-scripts-via-textexpander-or-bookmarklet
  2. # Script Name: Import Pythonista Script from Bookmarklet
  3.  
  4. # I got help from here: http://twolivesleft.com/Codea/Talk/discussion/1652/what-others-do%3A-pythonista/p1
  5. # I got help from here: http://www.macdrifter.com/2012/09/pythonista-trick-url-to-markdown.html
  6. # I got help from here: http://www.macstories.net/tutorials/from-instapaper-and-pythonista-to-dropbox-and-evernote-as-pdf/
  7.  
  8. import sys
  9. import urllib2
  10. import editor
  11. import os
  12.  
  13. url = sys.argv[1]
  14. scriptName = os.path.basename(url)
  15. contents = urllib2.urlopen(url).read()
  16. editor.make_new_file(scriptName[:-3], contents)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement