title: PYTHON | Apps Unable to Take Automated Mouse Input
body: <p>Recently after upgrading to <strong>Windows 11</strong>, I've found that some apps can't receive automated mouse and keyboard actions. The script simply goes to a location and clicks but after going to the location, the program doesn't respond to the clicks. Further more, the mouse cursor doesn't change to indicated that the element is <a href="https://previews.123rf.com/images/terrry4/terrry41905/terrry4190501002/122755848-computer-mouse-click-cursor-gray-arrow-icons-set-and-loading-icons-cursor-icon-vector-illustration.jpg" rel="nofollow noreferrer">clickable</a>. I've tried several methods already, PyDirectInput, Pynput and Pyautogui.</p>
  <p>I'm running the script to the application Roblox and I'm using Pycharm as an IDE.</p>
  <p>Script with pydirectinput:</p>
  <pre class="lang-py prettyprint-override"><code>import pydirectinput
  import pyautogui
  import time
  
  x, y = pyautogui.size()
  
  def click_ratio(xr, yr):
      global x, y
      pydirectinput.click(int(x/xr), int(y/yr))
  
  pyautogui.alert()
  time.sleep(1)
  click_ratio(1.057414291615035, 1.6881594372801876)
  </code></pre>
  <p>Script with pynput:</p>
  <pre class="lang-py prettyprint-override"><code>from pynput.mouse import Button, Controller
  import pyautogui
  import time
  
  x, y = pyautogui.size()
  mouse = Controller()
  
  def click_ratio(xr, yr):
      global x, y
      mouse.position((int(x/xr), int(y/yr)))
      mouse.click(Button.left, 2)
  
  pyautogui.alert()
  time.sleep(1)
  click_ratio(1.057414291615035, 1.6881594372801876)
  </code></pre>
  <p>Script using pyautogui:</p>
  <pre class="lang-py prettyprint-override"><code>import pyautogui
  import time
  
  x, y = pyautogui.size()
  
  def click_ratio(xr, yr):
      global x, y
      pyautogui.click((int(x/xr), int(y/yr)))
      
  
  pyautogui.alert()
  time.sleep(1)
  click_ratio(1.057414291615035, 1.6881594372801876)
  </code></pre>
  <p>The clicking works fine on Chrome. If anyone could help me, it would be greatly appreciated.</p>