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.
Add a comment
|
1 Answer
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.
1 Comment
alexis
Once in a great while, interacting with Windows is easier than expected... :-)