-1

I would like to execute a command (ex: myprogram.exe) in a python script.

the OS is windows 10: Normally, when i execute mycommand.exe in a terminal , it opens another popup windows which prompts the user to enter a credentials (ID and password).

the operation is as follows in command line:

  1. bin> myprogram.exe arg1 arg2;
  2. (windows open a popup with this message : do you want to allow this app to make changes to your device? -- Yes / no) => user clic yes );
  3. another terminal opens which prompts the user to enter Id and password;
  4. after hitting enter, mycommand.exe does its job..

Now, I would like to automate this tasks with python script. I use this function with subprocess module:

def myfunc():
    command = "..\\bin\\myprogram.exe backup file"
    subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr = subprocess.PIPE)
    return "done!"

but as i am new to python, i do not know how to handle the pop up windows that I mentioned above.

need help

I thank you in advance,

raindad85
  • 1
  • 2

1 Answers1

0

I haven't done GUI management in Python, but you might want to check out this post that details how to move windows around: Get HWND of each Window?. You will be able to use the ctypes and win32gui libraries to mess with your window.

Nulla
  • 62
  • 9