Copy and paste using Python commands [closed]

closed. this question is out of scope and is not currently accepting answers.

want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 1 year ago .

improve this question

I need to know how to make a copy of any text from the screen, simulating the mouse action. For the mouse, I am using PyAutoGui, performing the actions. I need to save the copied content and store this information in a variable for future use. Is there a way to do this ?

Author: Felipe Alencar, 2019-10-19

1 answers

Can use clipboard in conjunction with PyAutoGui.

Clipboard installation: pip install clipboard
It can be used like this:

import clipboard
import pyautogui

pyautogui.doubleClick(290, 150)
pyautogui.hotkey('ctrl', 'c')
text = clipboard.paste()
print(text)
 2
Author: Ewerton Belo, 2019-10-19 03:50:11