Skip to content

Instantly share code, notes, and snippets.

@pestilence669
Last active August 29, 2015 14:03
Show Gist options
  • Save pestilence669/56e18917f53b8613fb2a to your computer and use it in GitHub Desktop.
Save pestilence669/56e18917f53b8613fb2a to your computer and use it in GitHub Desktop.
Copies a string into the clipboard... on a Mac.
#!/usr/bin/env python
# vim: set ts=4 sw=4 noet:
import argparse
def shoveIntoClipboard(contents):
"Copies a string into the clipboard... on a Mac"
p = subprocess.Popen(['pbcopy'], stdin = subprocess.PIPE)
p.stdin.write(contents)
p.stdin.close()
return p.wait() == 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment