Roger,
Thanks much for the example code (and the implementation of the feature in
the first place!). It got me running. For posterity, I copied in my
function below that wraps up your sample code in a function. Thanks again!
-Scott
from win32com.shell import shell, shellcon
def launch_file_explorer(path, files):
'''Given a absolute base path and names of its children (no path), open
up one File Explorer window with all the child files selected'''
folder_pidl = shell.SHILCreateFromPath(path,0)[0]
desktop = shell.SHGetDesktopFolder()
shell_folder = desktop.BindToObject(folder_pidl, None,
shell.IID_IShellFolder)
name_to_item_mapping = dict([(desktop.GetDisplayNameOf(item, 0), item)
for item in shell_folder])
to_show = []
for file in files:
if not name_to_item_mapping.has_key(file):
raise Exception('File: "%s" not found in "%s"' % (file, path))
to_show.append(name_to_item_mapping[file])
shell.SHOpenFolderAndSelectItems(folder_pidl, to_show, 0)
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32