Can I infinitely loop a pyautogui function using time.sleep()?

I’m very new to python and I’m just trying to create a simple mouse moving+clicking script to remove some of my sent LinkedIn connection requests. I’m trying to make it loop infinitely but I just can’t figure it out 🙁 import pyautogui from time import sleep time.sleep(2) pyautogui.PAUSE = 2.5 pyautogui.moveTo(1171, 458) pyautogui.click() pyautogui.moveTo(1123, 403)… Read More Can I infinitely loop a pyautogui function using time.sleep()?

Image eecongition with pyautogui: How do I search for multiple areas at once?

I’m using python to search for images and I can do that with one area but how can I adapt this code for multiple areas? found_image = pyautogui.locateOnScreen(image) if found_image !=None: pyautogui.click(found_image) >Solution : welcome to stack! PIL has a flag for regions literally called region. If you specify where you regions are top left… Read More Image eecongition with pyautogui: How do I search for multiple areas at once?

Why am I getting an error stated that k is not defined, even though i have returned it?

Why am I getting an error stated that k is not defined, even though i have returned it? import pyautogui def askpass(): password = pyautogui.password(text=’Enter password for the database:’, title=”, default=”, mask=’*’) if password==’root’: print(‘password correct’) else: askpass() k=password return k askpass() print(k) >Solution : EDIT: I’ve missed the recursive askpass() when reading the code,… Read More Why am I getting an error stated that k is not defined, even though i have returned it?

Save hotkey screenshot in pyautogui

I have taken a screenshot using hotkeys in pyautogui, as that way I was able to get only the window content. Now I don’t seem to be able to save it. Am I doing something wrong or is there any way to get the screenshot? screenshot = pyautogui.hotkey(‘alt’, ‘printscreen’) screenshot.save(‘temp.jpg’) >Solution : Exspression pyautogui.hotkey(‘alt’, ‘printscreen’)… Read More Save hotkey screenshot in pyautogui

I need a faster while true command

I am making a very simple spambot for Discord just for pranking my friends. But the while True: command is very slow. Is there a faster alternative? import PIL import pyautogui, time time.sleep(5) pyautogui.FAILSAFE = True while True: pyautogui.hotkey("command", "v") pyautogui.press("enter") if (pyautogui.locateOnScreen("av.png")): (pyautogui.click(pyautogui.locateCenterOnScreen("av.png"))) >Solution : From the documentation: Like the enchanted brooms from the… Read More I need a faster while true command