[BangPypers] Library creation and modification on Windows 7

Nitin Kumar nitin.nitp at gmail.com
Wed Nov 14 10:37:46 CET 2012


Hi All,

I need to create or modify Libraries in windows 7 like Music, Documents.
I couldn't find any modules to do the same.

I also tried:

import pythoncom
from win32com.shell import shell
shortcut = pythoncom.CoCreateInstance(shell.CLSID_ShellLibrary,
None,pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLibrary)
>>> dir(shortcut)
['AddFolder', 'Commit', 'GetDefaultSaveFolder', 'GetFolderType',
'GetFolders', 'GetIcon', 'GetOptions', 'LoadLibraryFromItem',
'LoadLibraryFromKnownFolder', 'QueryInterface', 'RemoveFolder',
'ResolveFolder', 'Save', 'SaveInKnownFolder', 'SetDefaultSaveFolder',
'SetFolderType', 'SetIcon', 'SetOptions', '__class__', '__delattr__',
'__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__',
'__hash__', '__init__', '__le__', '__lt__', '__ne__', '__new__',
'__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__',
'__str__', '__subclasshook__']

>>> shortcut.AddFolder(r"trial")

Traceback (most recent call last):
  File "<pyshell#26>", line 1, in <module>
    shortcut.AddFolder(r"trial")
ValueError: argument is not a COM object (got type=str)

So Even when I got all the IShellLibrary APIs I am not able to call any
function as not sure how to pass parameter. (fore more details on API refer
http://msdn.microsoft.com/en-us/library/dd391719(v=vs.85).aspx)

Can anyone help me with these APIs calls?

-- 
Nitin K


More information about the BangPypers mailing list