'Python Loop (pyautogui)

Hii,I want to create a loop to fill an excel table with another and stop when it finds an empty field, which in this case would be the first ctrl+c as a reference, I tried to use pyperclip for copy and storage a variable, but it don't works the way I thought

import time

import pyautogui as pg
import pyperclip


#quando ctrl + c for igual a vazio exit()
#tentar fazer um lapso com while pra perguntar se conseguiu copiar todos os arquivos, mandar um confirm com 3 butoes

pg.PAUSE = 0.2

time.sleep(5)



pg.press("down")
pg.hotkey("ctrl", "c")
pg.keyDown("alt")
pg.press("tab")
pg.keyUp("alt")
pg.press("down")
pg.hotkey("ctrl", "v")

pg.keyDown("alt")
pg.press("tab")
pg.keyUp("alt")
pg.press("right", presses = 2)
pg.hotkey("ctrl", "c")
pg.keyDown("alt")
pg.press("tab")
pg.keyUp("alt")
pg.press("left")
pg.hotkey("ctrl", "v")

pg.keyDown("alt")
pg.press("tab")
pg.keyUp("alt")
pg.press("right")
pg.hotkey("ctrl", "c")
pg.keyDown("alt")
pg.press("tab")
pg.keyUp("alt")
pg.press("right", presses = 2)
pg.hotkey("ctrl", "v")

pg.keyDown("alt")
pg.press("tab")
pg.keyUp("alt")
pg.press("right", presses =2)
pg.hotkey("ctrl", "c")
pg.press("left", presses = 5)
pg.keyDown("alt")
pg.press("tab")
pg.keyUp("alt")
pg.press("right", presses = 2)
pg.hotkey("ctrl", "v")
pg.press("left", presses = 3)
pg.keyDown("alt")
pg.press("tab")
pg.keyUp("alt")


Sources

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

Source: Stack Overflow

Solution Source