当前位置: 首页>>代码示例>>Python>>正文


Python shell.SHGetPathFromIDList方法代码示例

本文整理汇总了Python中win32com.shell.shell.SHGetPathFromIDList方法的典型用法代码示例。如果您正苦于以下问题:Python shell.SHGetPathFromIDList方法的具体用法?Python shell.SHGetPathFromIDList怎么用?Python shell.SHGetPathFromIDList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在win32com.shell.shell的用法示例。


在下文中一共展示了shell.SHGetPathFromIDList方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: gui_webui_save_download

# 需要导入模块: from win32com.shell import shell [as 别名]
# 或者: from win32com.shell.shell import SHGetPathFromIDList [as 别名]
def gui_webui_save_download(self, d2save, path):
        try:
            if sys.platform == 'win32':
                from win32com.shell import shell
                pidl = shell.SHGetSpecialFolderLocation(0, 5)
                defaultpath = shell.SHGetPathFromIDList(pidl)
            else:
                defaultpath = os.path.expandvars('$HOME')
        except:
            defaultpath = ''

        filename = 'test.mkv'
        if globalConfig.get_mode() == 'client_wx':
            import wx
            dlg = wx.FileDialog(None, message='Save file', defaultDir=defaultpath, defaultFile=filename, wildcard='All files (*.*)|*.*', style=wx.SAVE)
            dlg.Raise()
            result = dlg.ShowModal()
            dlg.Destroy()
            if result == wx.ID_OK:
                path = dlg.GetPath()
                d2save.save_content(path) 
开发者ID:alesnav,项目名称:p2ptv-pi,代码行数:23,代码来源:BackgroundProcess.py

示例2: _setup_file_handler

# 需要导入模块: from win32com.shell import shell [as 别名]
# 或者: from win32com.shell.shell import SHGetPathFromIDList [as 别名]
def _setup_file_handler():
    global _file_handler
#    import traceback; traceback.print_stack()
    if not _file_handler:
        # Lookup path the user's personal folder in which
        #  to log Dragonfly messages.
        mydocs_pidl = shell.SHGetFolderLocation(0, shellcon.CSIDL_PERSONAL, 0, 0)
        mydocs_path = shell.SHGetPathFromIDList(mydocs_pidl)
        log_file_path = os.path.join(mydocs_path, "dragonfly.txt")
        _file_handler = logging.FileHandler(log_file_path)
        formatter = logging.Formatter("%(asctime)s %(name)s (%(levelname)s):"
                                  " %(message)s" + repr(_file_handler))
        _file_handler.setFormatter(formatter)
    return _file_handler


#--------------------------------------------------------------------------- 
开发者ID:t4ngo,项目名称:dragonfly,代码行数:19,代码来源:log.py

示例3: __get_open_save_mru

# 需要导入模块: from win32com.shell import shell [as 别名]
# 或者: from win32com.shell.shell import SHGetPathFromIDList [as 别名]
def __get_open_save_mru(self, str_opensave_mru):
        """Extracts OpenSaveMRU containing information about files selected in the Open and Save view"""
        # TODO : Win XP
        self.logger.info("Extracting open save MRU")
        hive_list = self._get_list_from_registry_key(registry_obj.HKEY_USERS, str_opensave_mru)
        to_csv_list = [("COMPUTER_NAME", "TYPE", "LAST_WRITE_TIME", "HIVE", "KEY_PATH", "ATTR_NAME", "REG_TYPE",
                        "ATTR_TYPE", "ATTR_DATA")]
        for item in hive_list:
            if item[KEY_VALUE_STR] == 'VALUE':
                if item[VALUE_NAME] != "MRUListEx":
                    pidl = shell.StringAsPIDL(item[VALUE_DATA])
                    path = shell.SHGetPathFromIDList(pidl)
                    to_csv_list.append((self.computer_name,
                                        "opensaveMRU",
                                        item[VALUE_LAST_WRITE_TIME],
                                        "HKEY_USERS",
                                        item[VALUE_PATH],
                                        item[VALUE_NAME],
                                        item[KEY_VALUE_STR],
                                        registry_obj.get_str_type(item[VALUE_TYPE]), path))
        return to_csv_list 
开发者ID:SekoiaLab,项目名称:Fastir_Collector,代码行数:23,代码来源:reg.py

示例4: __get_powerpoint_mru

# 需要导入模块: from win32com.shell import shell [as 别名]
# 或者: from win32com.shell.shell import SHGetPathFromIDList [as 别名]
def __get_powerpoint_mru(self, str_powerpoint_mru):
        """Extracts PowerPoint user mru"""
        # TODO : Win XP
        self.logger.info("Extracting PowerPoint MRU")
        hive_list = self._get_list_from_registry_key(registry_obj.HKEY_USERS, str_powerpoint_mru)
        to_csv_list = [("COMPUTER_NAME", "TYPE", "LAST_WRITE_TIME", "HIVE", "KEY_PATH", "ATTR_NAME", "REG_TYPE",
                        "ATTR_TYPE", "ATTR_DATA")]
        for item in hive_list:
            if item[KEY_VALUE_STR] == 'VALUE':
                if item[VALUE_NAME] != "MRUListEx":
                    pidl = shell.StringAsPIDL(item[VALUE_DATA])
                    path = shell.SHGetPathFromIDList(pidl)
                    to_csv_list.append((self.computer_name,
                                        "PowerPointMRU",
                                        item[VALUE_LAST_WRITE_TIME],
                                        "HKEY_USERS",
                                        item[VALUE_PATH],
                                        item[VALUE_NAME],
                                        item[KEY_VALUE_STR],
                                        registry_obj.get_str_type(item[VALUE_TYPE]), path))
        return to_csv_list 
开发者ID:SekoiaLab,项目名称:Fastir_Collector,代码行数:23,代码来源:reg.py

示例5: chooseOpenFolder

# 需要导入模块: from win32com.shell import shell [as 别名]
# 或者: from win32com.shell.shell import SHGetPathFromIDList [as 别名]
def chooseOpenFolder():
    """
    Open a dialog for user to choose a folder/directory.

    :return: the path to the folder, or None if not selected.
    """

    pidl, display_name, image_list = shell.SHBrowseForFolder(
        win32gui.GetDesktopWindow(),
        desktop_pidl,
        "Choose a folder",
        0,
        None,
        None
    )

    if pidl is None:
        return None

    return shell.SHGetPathFromIDList(pidl)


# Test code 
开发者ID:eavatar,项目名称:eavatar-me,代码行数:25,代码来源:simpledialog.py

示例6: ExplorePIDL

# 需要导入模块: from win32com.shell import shell [as 别名]
# 或者: from win32com.shell.shell import SHGetPathFromIDList [as 别名]
def ExplorePIDL():
    pidl = shell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_DESKTOP)
    print "The desktop is at", shell.SHGetPathFromIDList(pidl)
    shell.ShellExecuteEx(fMask=shellcon.SEE_MASK_NOCLOSEPROCESS,
                         nShow=win32con.SW_NORMAL,
                         lpClass="folder", 
                         lpVerb="explore", 
                         lpIDList=pidl)
    print "Done!" 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源:shellexecuteex.py

示例7: BrowseCallbackProc

# 需要导入模块: from win32com.shell import shell [as 别名]
# 或者: from win32com.shell.shell import SHGetPathFromIDList [as 别名]
def BrowseCallbackProc(hwnd, msg, lp, data):
    if msg== shellcon.BFFM_INITIALIZED:
        win32gui.SendMessage(hwnd, shellcon.BFFM_SETSELECTION, 1, data)
    elif msg == shellcon.BFFM_SELCHANGED:
        # Set the status text of the
        # For this message, 'lp' is the address of the PIDL.
        pidl = shell.AddressAsPIDL(lp)
        try:
            path = shell.SHGetPathFromIDList(pidl)
            win32gui.SendMessage(hwnd, shellcon.BFFM_SETSTATUSTEXT, 0, path)
        except shell.error:
            # No path for this PIDL
            pass 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:15,代码来源:browse_for_folder.py


注:本文中的win32com.shell.shell.SHGetPathFromIDList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。