1 year ago

#388806

test-img

MoMan

Is there a way to use ItemsView (pywinauto) to select multiple files in Win Explorer?

I am trying to create a way using pywinauto to select multiple files in Win Explorer.

The below code works great to select/get one file, but I am stuck on using the same approach to select multiple files.

The code is part of a method which takes a passed path, then splits the path string to get the filename. I use get_item(filename) to select the file. The last step is a right-click on the file.

if os.path.isdir(fso_to_select):
   item_to_select = fso_to_select.split("\\")[-1]

self.__explorer_win = self.__application.Window_(top_level_only=True, active_only=True,
                                                             class_name='CabinetWClass')
self.__explorer_win.set_focus().maximize()
fso_item = self.__explorer_win.ItemsView.get_item(item_to_select)
fso_item.right_click_input()

python

explorer

pywinauto

0 Answers

Your Answer

Accepted video resources