Skip to content

Instantly share code, notes, and snippets.

@embayer
Last active August 29, 2015 14:23
Show Gist options
  • Save embayer/eff1ffa5a9ddb285419d to your computer and use it in GitHub Desktop.
Save embayer/eff1ffa5a9ddb285419d to your computer and use it in GitHub Desktop.
monitor the clipboard and write to file
#!/usr/bin/python
import xerox
import time
def poll_cb():
cb = ""
cbh = ""
while True:
time.sleep(5)
cb = xerox.paste()
if cb != cbh:
cbh = cb
store(cb)
def store(link):
with open("links.txt", "a") as f:
f.write("%s\n" % link)
if __name__ == '__main__':
poll_cb()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment