import Cocoa pb = Cocoa.NSPasteboard.generalPasteboard() def get_clipboard_text(): """Get the text contents of the system clipboard. @return (string) """ return pb.stringForType_(Cocoa.NSPasteboardTypeString) def copy_text_to_clipboard(text): """Copy the supplied text to the clipboard. @param text """ pb.declareTypes_owner_([Cocoa.NSPasteboardTypeString], None) pb.setString_forType_(text, Cocoa.NSPasteboardTypeString)
Tuesday, April 8, 2014
Copying text via Python on OS X (revisited)
Let's try that again.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment