本文整理匯總了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)
示例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
#---------------------------------------------------------------------------
示例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
示例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
示例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
示例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!"
示例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