Created
May 8, 2015 02:23
-
-
Save CodyKochmann/80dddff75fb11ea41552 to your computer and use it in GitHub Desktop.
python functions that give clipboard access to the script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
def getClipboardData(): | |
p = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE) | |
retcode = p.wait() | |
data = p.stdout.read() | |
return data | |
def setClipboardData(data): | |
p = subprocess.Popen(['pbcopy'], stdin=subprocess.PIPE) | |
p.stdin.write(data) | |
p.stdin.close() | |
retcode = p.wait() | |
print getClipboardData() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment