I want to start with a folder e.g. C:\test
instead of any of the predefined CSIDL_* folders.
How can I achieve that?
''' python 3.6.2 '''
import os
import win32gui
from win32com.shell import shell, shellcon
myfolder_pidl = shell.SHGetFolderLocation (0, shellcon.CSIDL_DESKTOP, 0, 0)
pidl, display_name, image_list = shell.SHBrowseForFolder (
win32gui.GetDesktopWindow (),
myfolder_pidl,
"Select a file or folder",
0x00014050, #shellcon.BIF_BROWSEINCLUDEFILES and some more
None,
None
)
if (pidl, display_name, image_list) == (None, None, None):
print ('Nothing selected')
else:
my_path = shell.SHGetPathFromIDList (pidl)
file_to_process = my_path.decode()
''' continue processing file_to_process
'''