'Why does my python script work on desktop but not in programes
So I tried making my first ever script, for some reason the script works fine while im still on desktop, but when I enter a video game (In my example GTA V) the script doesn't input mouse movement, clicks or keyboard. Ive found some solutions online but non work for me... Any help?
from pydirectinput import *
import pyautogui
import pydirectinput
import time
import keyboard
import random
import win32api, win32con
import sys
while True:
riba3 = pyautogui.locateCenterOnScreen('riba3.png', confidence=0.5)
riba2 = pyautogui.locateCenterOnScreen('riba2.png', confidence=0.5)
riba1 = pyautogui.locateCenterOnScreen('riba1.png', confidence=0.5)
if riba3:
pyautogui.moveTo(riba3)
pyautogui.click(clicks=3, interval=1)
elif riba2:
pyautogui.moveTo(riba2)
pyautogui.click(clicks=3, interval=1)
elif riba1:
pyautogui.moveTo(riba1)
pyautogui.click(clicks=3, interval=1)
Solution 1:[1]
Make sure the terminal you are using to run python file has admin access. I was stuck with the same problem but running the command prompt in admin mode and then launching the py file solved my problem.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Shubham tyagi |
