On 17/06/2011 14:19, reckoner wrote:

Depends what you need to do. To add in item, use the SHAddToRecentDocs
API from the shell module:

<code>
import sys
from win32com.shell import shell, shellcon

shell.SHAddToRecentDocs (
    shellcon.SHARD_PATHW,
    sys.executable
)

</code>

To access its contents (in file system terms):

<code>
import os, sys
from win32com.shell import shell, shellcon

mru = shell.SHGetSpecialFolderPath (0, shellcon.CSIDL_RECENT, 0)
print os.listdir (mru)

</code>

To access it as shell folder:

<code>
import os, sys
from win32com.shell import shell, shellcon

mru_pidl = shell.SHGetSpecialFolderLocation (0, shellcon.CSIDL_RECENT)
desktop = shell.SHGetDesktopFolder ()
mru_folder = desktop.BindToObject (
    mru_pidl,
    None,
    shell.IID_IShellFolder
)

for i in mru_folder:
    print mru_folder.GetDisplayNameOf (i, shellcon.SHGDN_NORMAL)

</code>

TJG


Thank you! This is a big help. Is there a way to find out which program called which item in the MRU list and when that occurred?

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to