开发者

Access Most Recently Used (MRU) entries via Python on Windows?

Using Python, is it possible to get acc开发者_开发百科ess to the Most Recently Used (MRU) list in windows. This is where Windows keeps a list of the most recently opened documents and programs.

Thanks!


Possible: yes, easy yes. the challenge though is choosing which MRU to choose from... windows and programs stores dozens of em - windows alone probably stores 6 of them. presuming you want the Windows run dialogue you can get it like so (Python 2x syntax, tested on python 2.7):

def get_run_mru():
    import _winreg
    regKey = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
        r'Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU')
    recent = _winreg.QueryValueEx(regKey,'MRUList')[0]
    recent_list = []
    for subkey in recent:
        recent_list.append(_winreg.QueryValueEx(regKey,subkey)[0])
    return recent_list

Of course then you'll have to do whatever you want to do with that but that should get you started.

Pacific

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜