Last active
January 16, 2026 22:38
-
-
Save sebastianjnuwu/4025116fe66f41159c48a012d32609cc to your computer and use it in GitHub Desktop.
O script automatiza a cópia de imagens entre abas do navegador. Com Alt + W, ele clica no centro da tela, abre o menu da imagem, copia, muda para a segunda aba, cola, volta para a primeira e avança para a próxima imagem. O processo roda em loop, pode ser pausado com Alt + O, retomado com Alt + N e encerrado com Alt + Delete, mantendo logs no ter…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pyautogui | |
| import time | |
| import threading | |
| from datetime import datetime | |
| from pynput import keyboard | |
| pyautogui.FAILSAFE = False | |
| DELAY = 0.6 | |
| RESET = "\033[0m" | |
| VERDE = "\033[92m" | |
| AMARELO = "\033[93m" | |
| AZUL = "\033[94m" | |
| VERMELHO = "\033[91m" | |
| PAUSADO = False | |
| ENCERRAR = False | |
| RODANDO = False | |
| ALT = False | |
| def log(msg, cor=RESET): | |
| hora = datetime.now().strftime("%H:%M:%S") | |
| print(f"{cor}[{hora}] {msg}{RESET}") | |
| def checar_pausa(): | |
| while PAUSADO and not ENCERRAR: | |
| time.sleep(0.1) | |
| def copiar_colar(): | |
| w, h = pyautogui.size() | |
| x = w // 2 | |
| y = h // 2 | |
| pyautogui.moveTo(x, y, duration=0.15) | |
| pyautogui.rightClick() | |
| time.sleep(0.25) | |
| for _ in range(4): | |
| pyautogui.press("down") | |
| time.sleep(0.05) | |
| pyautogui.press("enter") | |
| log("IMAGEM COPIADA (MENU)", AZUL) | |
| time.sleep(0.4) | |
| pyautogui.hotkey("ctrl", "2") | |
| pyautogui.hotkey("ctrl", "v") | |
| log("IMAGEM COLADA", AMARELO) | |
| time.sleep(0.3) | |
| pyautogui.hotkey("ctrl", "1") | |
| time.sleep(0.3) | |
| pyautogui.press("right") | |
| log("PRÓXIMA IMAGEM", VERDE) | |
| def processo(): | |
| global RODANDO | |
| log("PROCESSO INICIADO", VERDE) | |
| while not ENCERRAR: | |
| checar_pausa() | |
| if ENCERRAR: | |
| break | |
| copiar_colar() | |
| time.sleep(DELAY) | |
| RODANDO = False | |
| log("PROCESSO FINALIZADO", VERMELHO) | |
| def iniciar_processo(): | |
| global RODANDO | |
| if RODANDO: | |
| return | |
| RODANDO = True | |
| threading.Thread(target=processo, daemon=True).start() | |
| def on_press(key): | |
| global ALT, PAUSADO, ENCERRAR | |
| if key in (keyboard.Key.alt_l, keyboard.Key.alt_r): | |
| ALT = True | |
| if ALT: | |
| if key == keyboard.Key.delete: | |
| ENCERRAR = True | |
| log("ENCERRADO (ALT+DELETE)", VERMELHO) | |
| return False | |
| try: | |
| if key.char == "w": | |
| iniciar_processo() | |
| elif key.char == "o": | |
| if not PAUSADO: | |
| PAUSADO = True | |
| log("PAUSADO (ALT+O)", VERMELHO) | |
| elif key.char == "n": | |
| if PAUSADO: | |
| PAUSADO = False | |
| log("CONTINUADO (ALT+N)", VERDE) | |
| except: | |
| pass | |
| def on_release(key): | |
| global ALT | |
| if key in (keyboard.Key.alt_l, keyboard.Key.alt_r): | |
| ALT = False | |
| log("SCRIPT ATIVO", VERDE) | |
| log("Alt+W inicia | Alt+O pausa | Alt+N continua | Alt+Delete encerra", AMARELO) | |
| with keyboard.Listener(on_press=on_press, on_release=on_release) as listener: | |
| listener.join() |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pip install pyautogui pynput