Skip to content

Instantly share code, notes, and snippets.

@davidlares
Created February 3, 2020 20:20
Show Gist options
  • Save davidlares/646070f6e971ba7c4035d1146e2bbe14 to your computer and use it in GitHub Desktop.
Save davidlares/646070f6e971ba7c4035d1146e2bbe14 to your computer and use it in GitHub Desktop.
A Python 2.x script for demonstrating the Pyperclip package
#!/usr/bin/python
import pyperclip
import time
p_list = [] # list datatype for password clipboard selection
while True:
# evaluating existence
if pyperclip.paste() != 'None':
value = pyperclip.paste() # paste content
if value not in p_list:
p_list.append(value) # appending to hthe list
# priting values
print(p_list)
# force 3 sec sleep for checking the clipboard status
time.sleep(3)
@davidlares
Copy link
Author

In some cases, you will be in scenarios where the clipboard element is empty. In that particular case, the list structure will be printed instead of evaluating the "None" value as "empty".

In Windows OS's you can create a shortcut in the Desktop with this content. in order to clear programmatically the clipboard tool: the content for that shortcut is cmd /c “echo off | clip”. You can use this tiny small script for any purpose at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment