-1
I need to copy a text and I’m using the autopygui. I would like to know how best to select the text and how to store this information in a variable?
The solution I have found so far for the first problem was to tighten the shift and click on the end point of the text. For the second, I am still learning.
Follows the code.
import pyautogui
pyautogui.leftClick(1218,1051)
pyautogui.keyDown('shift')
pyautogui.leftClick(82,68)
pyautogui.keyUp('shift')
See the
hotkey
. Something like:pyautogui.hotkey('ctrl', 'c')
to copy andpyautogui.hotkey('ctrl', 'v')
to glue.– Paulo Marques
As it has not been said where you are trying to get the text from, I will give a safer suggestion if it is web page. Make the Web Scraping, is a healthier and safer way for your application. If you can give us more information, I can try to help otherwise.
– Eduardo Garcia de Oliveira