Advertisement
n8henrie

Import Pythonista Script from Clipboard

Feb 21st, 2013
1,828
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. # Script posted at: http://n8henrie.com/2013/02/quickly-import-pythonista-scripts-via-textexpander-or-bookmarklet
  2. # Script name: Import Pythonista Script from Clipboard
  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.  
  7. import clipboard
  8. import urllib2
  9. import editor
  10. import os
  11.  
  12. url = clipboard.get()
  13. scriptName = os.path.basename(url)
  14. contents = urllib2.urlopen(url).read()
  15. editor.make_new_file(scriptName[:-3], contents)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement