Scott Nelson wrote: > Greetings... > > Would anyone happen to have some sample code of how to use > SHOpenFolderAndSelectItems? I've been tinkering with it and haven't got > anything to work yet. This is the closest I've got: > >>>> from win32com.shell import shell >>>> shell.SHOpenFolderAndSelectItems((r'c:\junk', ), 1) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > TypeError: Must be an array of IDLs > > The errors I've seen in my experiments mention "IDLs" and "ITEMIDLIST" > objects. I've dug a bit through the pywin32 docs and MDSN and didn't have > much luck understanding what the Python wrapper required and how to > construct these object. I must admit I don't have much Win32 API > programming experience. > > I'm using Active State's Python 2.6.2.2 on Vista and I installed the 32 bit > version of pywin32, build 217. > > For reverence, here's some links: > I submitted the feature request for SHOpenFolderAndSelectItems: > http://sourceforge.net/tracker/?func=detail&aid=3396444&group_id=78018&atid=551957 > > The changeset that implements this function is here: > http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/rev/1452829d69ec. > > And, here's the MSDN doc: > http://msdn.microsoft.com/en-us/library/bb762232%28v=vs.85%29.aspx > > Any nudges in the right direction would be helpful. > > Thanks! > > -Scott > from win32com.shell import shell, shellcon import win32api
folder = win32api.GetTempPath() folder_pidl=shell.SHILCreateFromPath(folder,0)[0] desktop = shell.SHGetDesktopFolder() shell_folder = desktop.BindToObject(folder_pidl, None, shell.IID_IShellFolder) items = [item for item in shell_folder][:5] ## print (items) shell.SHOpenFolderAndSelectItems(folder_pidl, items, 0) _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32