1

so my problem is -

I made a simple app in python which checks if a program runs, if not it runs the program and perform a couple of mouse clicks on that program.

For some reason, I can't mouse click the program, Altho if I set it to just do some mouse click on the desktop for example it works great... Any chance that the program blocks my automated clicks? shouldn't it stimulate a normal mouse click as I click my self?

attaching a code just so will see how I make the mouse click -

        app.update()
        app.focus_force()
        pywinauto.mouse.click(button='left', coords=(1096, 728))

btw, Iv'e also tried to make the clicks with simple ctypes which didn't help.

thanks for reading.

Ben
  • 793
  • 2
  • 13
  • 29
  • Is that target program publicly available? Did you ever try to use Inspect.exe? – Vasily Ryabov May 26 '17 at 19:42
  • The [Getting Started Guide](https://pywinauto.readthedocs.io/en/latest/getting_started.html) may help you to solve this challenge step by step. You may use not only clicks but other more complicated functions that don't do realistic click like a real user. – Vasily Ryabov May 26 '17 at 20:20
  • Thanks, problem was that I didn't ran the script with elevated privileges... probably its needed cuz I run the process with elevated priviliges aswell – Ben May 26 '17 at 21:58
  • Ah, yes. This is pretty common problem. I'm planning to add some warning if there are no enough privileges. – Vasily Ryabov May 27 '17 at 14:54
  • Possible duplicate of [Which is the easiest way to simulate keyboard and mouse on Python?](https://stackoverflow.com/questions/2791839/which-is-the-easiest-way-to-simulate-keyboard-and-mouse-on-python) – kenorb Jan 07 '18 at 14:47

1 Answers1

1

Well, eventually all I needed was to make sure I run the script with elevated privileges.

when doing so everything works fine.

How you do that -

Run cmd as adminstrator -> navigate to your script folder - > python script.py

Ben
  • 793
  • 2
  • 13
  • 29