1

I have a directory of .xml files, and one exe file. I would like to write a python script which will use those .xml files (one at a time) on the .exe file emulating dragging and dropping. It cannot however actually control the mouse cursor.
I've looked for resources on this but cannot find anything. Any hints in the right direction would be very helpful, if it is even do-able.
Thank you for your time.

1 Answer 1

3

Forget about controlling the cursor: Dragging and dropping on Windows simply calls the program you drop things on, with the full path of the dropped files as arguments. So if you want to run myprogram.exe on all files in its folder, do something like this:

from glob import glob
import subprocess

for filename in glob("./*.xml"):
    subprocess.call(["myprogram.exe", filename])    

You were not entirely clear on what you wanted to do, so you may have to make some adjustments, but it should be along such lines. The call to glob is to ensure that only xml files get run.

Sign up to request clarification or add additional context in comments.

1 Comment

Once in a great while, interacting with Windows is easier than expected... :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.