asweigart / pyautogui

A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
BSD 3-Clause "New" or "Revised" License
10.45k stars 1.26k forks source link

pyautogui was running fine on Windows 7. but NOT working on Windows 11. #788

Open siliconbeaver opened 1 year ago

siliconbeaver commented 1 year ago

Hello,

I am moving from Windows 7 to Windows 11 as new PC NOT supports Windows 7 any longer. It's noticed that my pyautogui script was running fine on Windows 7. but NOT on Windows 11.

my pyautogui moves onto 16 spots of a 4x4 grid then input and return on each spot. On Windows 11, the cursor trapped in IDLE shell window. NOT move (out) as programmed. per ChatGPT, it's by a security feature called User Interface Privilege Isolation (UIPI) in Windows 11.

Can anyone help?

Thanks,



xyList = []
kCount = 0
for iy in range(0,4):
    for ix in range(0,4):
        x0 = xy0[0] + ix*dx
        y0 = xy0[1] + iy*dy
        thisInput = InputList[kCount]
        kCount = kCount+1
        xyTmp = [x0,y0]
        xyList.append([xyTmp])
        pyautogui.click(x0,y0)
        pyautogui.hotkey('ctrl','a')
        pyautogui.press('delete')
        pyautogui.press('enter')
        time.sleep(0.01)
        pyperclip.copy(thisInput)
        pyautogui.hotkey('ctrl','v')
        time.sleep(0.01)
        pyautogui.press('enter')

im = pyautogui.screenshot(region = (0,40,1920,1093))
SG-Yang commented 1 year ago

Not working for us as well.

  self.driver.find_element_by_class('add-file').click()
                            sleep(3)
                            pyperclip.copy('001.docx')
                            sleep(2)
                            pyautogui.hotkey('ctrl', 'v')
                            pyautogui.press('enter', 1)
siliconbeaver commented 1 year ago

ChatGPT has said,

It's a Windows security issue in Windows 11.

pyautogui is working in Windows 7. but the problem can be easily duplicated/re-confirmed in Windows 7 by changing security level. While in Windows 11, even I had setup security level to lowest level. the problem was still NOT gone.

It's my wish that, either Microsoft or python could release its solution on platform of Windows 11 so that my PC can move its OS to Windows 11.