I like to be a bit cautious with this type of functionality because it's potentially a pretty big maintenance burden when I make internal changes in the editor etc...
There are already some fun things you can do with objc_util though. As an example, here's a script that appends to a Scrapbook.txt file every time you copy something to the clipboard (with a timestamp). If you'd include this in pythonista_startup.py, it comes pretty close to built-in functionality.
# coding: utf-8
from objc_util import *
def pasteboardChanged_(_self, _cmd, _n):
from datetime import datetime
# Don't add to ScrapBook when copying from it...
timestamp = datetime.strftime(datetime.now(), '%Y-%m-%d - %H:%M')
text = clipboard.get()
with open('Scrapbook.txt', 'a') as f:
f.write('\n\n=== %s\n%s' % (timestamp, text))
Observer = ObjCClass('ScrapbookPasteboardObserver')
# Observer was already created, don't do anything...
NSNotificationCenter = ObjCClass('NSNotificationCenter')
UIPasteboard = ObjCClass('UIPasteboard')
Observer = create_objc_class('ScrapbookPasteboardObserver', methods=[pasteboardChanged_])
obs = Observer.new()
NSNotificationCenter.defaultCenter().addObserver_selector_name_object_(obs, sel('pasteboardChanged:'), 'UIPasteboardChangedNotification', UIPasteboard.generalPasteboard())