'How to create a program that sycles through your copied stuff?

I'm trying to make a program that cycles through your clipboard, recording the different ones. I'm having several issues with this code but the a variable works.

  1. When I select r (so to the right) it gives me always a - even when I already copied another thing. This Is a major flaw and the code doesn't work because of it. I think I need to redisign the whole shape of the code but I don't know how to.
  2. When I select r and then back to l (So to the main code) it gives me a message that I'm already at the bottom that i coded in to stop it from breaking. This needs fixing too pleaseeee.
  3. This is not so big but when i select l two times immediately after i open the program, It first gives me the error that I'm at the bottom how its supposed to. But then it gives me the incorrect use error.
from pyperclip import *

var = 1
a = paste()
def a1():
    print(a)
def b1():
    waitForNewPaste()
    b = paste()
a1()
bi = input('left or right?(l/r)')
def wait():
    waitForNewPaste()
    b=paste()
    
while True:
    if bi == 'l':
        if var == 1:
            pass
            print('you are already at bottom, try again!')
            bi = input('left or right?(l/r)')
        elif var == 2:
            a1()
            bi = input('left or right?(l/r)')
            
            var == 1
    if bi == 'r':
        try:
            b
        except NameError:
            b = '-'
        if var == 1:
            print(b)
            
            var == 2
            bi = input('left or right?(l/r)')
        elif var == 2:
            pass
    else:
        print('Incorrect use, try again!')
        bi = input('left or right?(l/r)')

wait()

I'm completely lost it would be nice of someone to help, Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source