Simulate windows drag and drop with code?

前端 未结 2 428
我寻月下人不归
我寻月下人不归 2021-01-24 00:50

I think I may have asked a similar question in the past, but I am still stuck...

As part of an automated process, I must \"import\" a specific subset of media files into

2条回答
  •  心在旅途
    2021-01-24 01:36

    Mouse move/click is probably the best solution in this case. Here is something you can try. Assuming you are using windows since you put c# in the title

    1. open up the folder
    2. move mouse to the search box of the folder ( does not have to be hard coded coordinate, some GUI tool can recognize it)
    3. use send string method to input the name of the file that you wish to import
    4. move mouse to select the first result
    5. mouse down
    6. use either pixel detection or GUI tool's detection to determine the coordinate of the panel that you wish to drop on
    7. drop it and do some error check.

    OR

    If you are an expert of Windows you can try to do some inter process communication to send the drag and drop event to the program.

提交回复
热议问题