Reputation: 702
I have written a very short python-function (using pyautogui) which entails the following:
Now, I have noticed the following odd behavior: The first step always works, i.e. the specific program window is appears on the screen. However, depending on the specific program the second step either works or goes wrong. More specifically, I noticed that for notepad it works (i.e. the cursor moves to the specified location), whereas for a different program the mouse does not move at all.
Can anyone shed some light onto this behavior?
Thank you very much for your help!
Upvotes: 2
Views: 6383
Reputation: 89
You might have found the answer already, but if so, maybe someone else can use the answer i found.
I found using:
pyautogui.moveTo(x,y)
pyautogui.mouseDown()
time.sleep(0.5) #or whatever you need, if even needed
pyautoguii.mouseUp()
will do the click that pyautogui.click(x,y) will not. I cannot say if it will work in all situations, but its worth a try.
Upvotes: 2
Reputation: 66
it seems like the program is overwriting the script as a security method.
could you try and convert the code into exe file and run as an admin. this should overwrite the program.
Upvotes: 2