Python win32com.shell.shell.SHGetPathFromIDList() Examples
The following are 9
code examples of win32com.shell.shell.SHGetPathFromIDList().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
win32com.shell.shell
, or try the search function
.
Example #1
Source File: BackgroundProcess.py From p2ptv-pi with MIT License | 6 votes |
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)
Example #2
Source File: log.py From dragonfly with GNU Lesser General Public License v3.0 | 6 votes |
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 #---------------------------------------------------------------------------
Example #3
Source File: reg.py From Fastir_Collector with GNU General Public License v3.0 | 6 votes |
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
Example #4
Source File: reg.py From Fastir_Collector with GNU General Public License v3.0 | 6 votes |
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
Example #5
Source File: simpledialog.py From eavatar-me with Apache License 2.0 | 6 votes |
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
Example #6
Source File: shellexecuteex.py From Email_My_PC with MIT License | 6 votes |
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!"
Example #7
Source File: shellexecuteex.py From ironpython2 with Apache License 2.0 | 5 votes |
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!"
Example #8
Source File: browse_for_folder.py From ironpython2 with Apache License 2.0 | 5 votes |
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
Example #9
Source File: browse_for_folder.py From Email_My_PC with MIT License | 5 votes |
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