Amazing tool Auto Copy paste Clipboard Using Python

901

today we will be creating an amazing tool Auto Copy paste Clipboard Using Python Have you ever searched for data from the web?

Amazing tool Auto Copy paste Clipboard Using Python

Of course, you did somewhere someplace and you needed to copy and paste data or let’s say content from web page to notepad and word pad. But copying and pasting the process is not easy if you have to do it again and again. But which I mean again and again minimizing and maximizing the window screen.

If there are multiple windows then sometimes you are just confused So I have created a simple tool in python how this tool works?

When you copy something from a webpage automatically it will paste your copied data on a notepad suppose you need lots of different spellings all you have to do is select the word and copy and the python script will do the rest for you.

Amazing tool Auto Copy paste Clipboard Using Python (Source code)

install:- pip install pyperclip

import time
import sys
import os
from time import strftime

sys.path.append(os.path.abspath("SO_site-packages"))

import pyperclip

recent_value = ""

D = time.strftime("%D")
r = time.strftime("%r")

while True:
    tmp_value = pyperclip.paste()
    if tmp_value != recent_value:
        recent_value = tmp_value
        print("Value changed: %s" % str(recent_value)[:20])
        with open('out_clipboard.txt', '+a') as output:
            try:
                output.write("[Start]----------------"+D+" "+r+"----------------\n")
                output.write("%s\n\n" % str(tmp_value))
                output.write("[End]-----------------------------------------------------------------\n\n\n")
            except:
                output.write("[Start]----------------" + D + " " + r+"----------------\n")
                output.write("%s\n\n" % str(tmp_value.encode('UTF-8')))
                output.write("[End]-----------------------------------------------------------------\n\n\n")
    time.sleep(0.1)

In case of any question feel free to ask me in social media

Also Read

Python Program to Remove Empty Strings from a List

Python program will print 1 to 10 numbers using while loop

Python program to print odd numbers between 1 to 10 using while loop

Python Program to check Prime Number

LEAVE A REPLY

Please enter your comment!
Please enter your name here