Advertisement
MizunoBrasil

Lê url e imprime no terminal

Jun 15th, 2023 (edited)
598
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. import pyperclip
  2. import win32com.client
  3.  
  4. # Criando uma instância do objeto Shell do Windows
  5. shell = win32com.client.Dispatch("WScript.Shell")
  6.  
  7. # Abrindo uma nova janela do Chrome e esperando que ela seja ativada
  8. shell.SendKeys("^t")
  9. shell.AppActivate("Google Chrome")
  10.  
  11. # Aguardando um breve intervalo para garantir que a janela do Chrome esteja ativa
  12. import time
  13. time.sleep(1)
  14.  
  15. # Copiando a URL da barra de favoritos para a área de transferência
  16. shell.SendKeys("^l")
  17. shell.SendKeys("^c")
  18.  
  19. # Obtendo a URL da área de transferência
  20. url = pyperclip.paste()
  21.  
  22. # Exibindo a URL copiada
  23. print("URL copiada:", url)
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement