shell – Shell functionality

Wrappers around standard functionality from the semi-independent Windows Shell subsystem which powers the desktop, shortcuts, special folders, property sheets &c.

Implemented so far:

  • Shortcuts: use the shortcut() function to edit or create desktop shortcuts
  • [EXPERIMENTAL] Properties: use the properties() function to expose property sheet data
  • Standard folders: commonly-accessed shell folders are exposed at module level, eg desktop(), startup(), recent()

Functions

shortcut(source=<Unset>)
properties(source)

Classes

class Shortcut(filepath=<Unset>, **kwargs)

Constants

CSIDL
Name Val Win32
DESKTOP 0 CSIDL_DESKTOP
INTERNET 1 CSIDL_INTERNET
BITBUCKET 10 CSIDL_BITBUCKET
STARTMENU 11 CSIDL_STARTMENU
MYDOCUMENTS 12 CSIDL_MYDOCUMENTS
MYMUSIC 13 CSIDL_MYMUSIC
MYVIDEO 14 CSIDL_MYVIDEO
DESKTOPDIRECTORY 16 CSIDL_DESKTOPDIRECTORY
DRIVES 17 CSIDL_DRIVES
NETWORK 18 CSIDL_NETWORK
NETHOOD 19 CSIDL_NETHOOD
PROGRAMS 2 CSIDL_PROGRAMS
FONTS 20 CSIDL_FONTS
TEMPLATES 21 CSIDL_TEMPLATES
COMMON_STARTMENU 22 CSIDL_COMMON_STARTMENU
COMMON_PROGRAMS 23 CSIDL_COMMON_PROGRAMS
COMMON_STARTUP 24 CSIDL_COMMON_STARTUP
COMMON_DESKTOPDIRECTORY 25 CSIDL_COMMON_DESKTOPDIRECTORY
APPDATA 26 CSIDL_APPDATA
PRINTHOOD 27 CSIDL_PRINTHOOD
LOCAL_APPDATA 28 CSIDL_LOCAL_APPDATA
ALTSTARTUP 29 CSIDL_ALTSTARTUP
CONTROLS 3 CSIDL_CONTROLS
COMMON_ALTSTARTUP 30 CSIDL_COMMON_ALTSTARTUP
COMMON_FAVORITES 31 CSIDL_COMMON_FAVORITES
INTERNET_CACHE 32 CSIDL_INTERNET_CACHE
COOKIES 33 CSIDL_COOKIES
HISTORY 34 CSIDL_HISTORY
COMMON_APPDATA 35 CSIDL_COMMON_APPDATA
WINDOWS 36 CSIDL_WINDOWS
SYSTEM 37 CSIDL_SYSTEM
PROGRAM_FILES 38 CSIDL_PROGRAM_FILES
MYPICTURES 39 CSIDL_MYPICTURES
PRINTERS 4 CSIDL_PRINTERS
PROFILE 40 CSIDL_PROFILE
SYSTEMX86 41 CSIDL_SYSTEMX86
PROGRAM_FILESX86 42 CSIDL_PROGRAM_FILESX86
PROGRAM_FILES_COMMON 43 CSIDL_PROGRAM_FILES_COMMON
PROGRAM_FILES_COMMONX86 44 CSIDL_PROGRAM_FILES_COMMONX86
COMMON_TEMPLATES 45 CSIDL_COMMON_TEMPLATES
COMMON_DOCUMENTS 46 CSIDL_COMMON_DOCUMENTS
COMMON_ADMINTOOLS 47 CSIDL_COMMON_ADMINTOOLS
ADMINTOOLS 48 CSIDL_ADMINTOOLS
CONNECTIONS 49 CSIDL_CONNECTIONS
PERSONAL 5 CSIDL_PERSONAL
COMMON_MUSIC 53 CSIDL_COMMON_MUSIC
COMMON_PICTURES 54 CSIDL_COMMON_PICTURES
COMMON_VIDEO 55 CSIDL_COMMON_VIDEO
RESOURCES 56 CSIDL_RESOURCES
RESOURCES_LOCALIZED 57 CSIDL_RESOURCES_LOCALIZED
COMMON_OEM_LINKS 58 CSIDL_COMMON_OEM_LINKS
CDBURN_AREA 59 CSIDL_CDBURN_AREA
FAVORITES 6 CSIDL_FAVORITES
COMPUTERSNEARME 61 CSIDL_COMPUTERSNEARME
STARTUP 7 CSIDL_STARTUP
RECENT 8 CSIDL_RECENT
SENDTO 9 CSIDL_SENDTO
STGM
Name Val Win32
FAILIFTHERE 0 STGM_READ
READ 0 STGM_READ
DIRECT 0 STGM_READ
WRITE 1 STGM_WRITE
NOSCRATCH 1048576 STGM_NOSCRATCH
CONVERT 131072 STGM_CONVERT
SIMPLE 134217728 STGM_SIMPLE
SHARE_EXCLUSIVE 16 STGM_SHARE_EXCLUSIVE
READWRITE 2 STGM_READWRITE
NOSNAPSHOT 2097152 STGM_NOSNAPSHOT
PRIORITY 262144 STGM_PRIORITY
SHARE_DENY_WRITE 32 STGM_SHARE_DENY_WRITE
CREATE 4096 STGM_CREATE
SHARE_DENY_READ 48 STGM_SHARE_DENY_READ
SHARE_DENY_NONE 64 STGM_SHARE_DENY_NONE
TRANSACTED 65536 STGM_TRANSACTED
DELETEONRELEASE 67108864 STGM_DELETEONRELEASE
STGFMT
Name Val Win32
STORAGE 0 STGFMT_STORAGE
DOCUMENT 0 STGFMT_STORAGE
NATIVE 1 STGFMT_NATIVE
FILE 3 STGFMT_FILE
ANY 4 STGFMT_ANY
DOCFILE 5 STGFMT_DOCFILE
FMTID
Name Val Win32
Intshcut {000214A0-0000-0000-C000-000000000046} Intshcut
InternetSite {000214A1-0000-0000-C000-000000000046} InternetSite
ImageProperties {14B81DA1-0135-4D31-96D9-6CBFC9671A99} ImageProperties
ShellDetails {28636AA6-953D-11D2-B5D6-00C04FD918D0} ShellDetails
Briefcase {328D8B21-7729-4BFC-954C-902B329D56B0} Briefcase
Query {49691C90-7E17-101A-A91C-08002B2ECDA9} Query
ImageSummaryInformation {6444048F-4C8B-11D1-8B70-080036B11A03} ImageSummaryInformation
AudioSummaryInformation {64440490-4C8B-11D1-8B70-080036B11A03} AudioSummaryInformation
MediaFileSummaryInformation {64440492-4C8B-11D1-8B70-080036B11A03} MediaFileSummaryInformation
Displaced {9B174B33-40FF-11D2-A27E-00C04FC30871} Displaced
Misc {9B174B34-40FF-11D2-A27E-00C04FC30871} Misc
Volume {9B174B35-40FF-11D2-A27E-00C04FC30871} Volume
Storage {B725F130-47EF-101A-A5F1-02608C9EEBAC} Storage
DocSummaryInformation {D5CDD502-2E9C-101B-9397-08002B2CF9AE} FMTID_DocSummaryInformation
UserDefinedProperties {D5CDD505-2E9C-101B-9397-08002B2CF9AE} FMTID_UserDefinedProperties
WebView {F2275480-F782-4291-BD94-F13693513AEC} WebView
SummaryInformation {F29F85E0-4FF9-1068-AB91-08002B27B3D9} SummaryInformation
PIDSI
Name Val Win32
EDITTIME 10 PIDSI_EDITTIME
LASTPRINTED 11 PIDSI_LASTPRINTED
CREATE_DTM 12 PIDSI_CREATE_DTM
LASTSAVE_DTM 13 PIDSI_LASTSAVE_DTM
PAGECOUNT 14 PIDSI_PAGECOUNT
WORDCOUNT 15 PIDSI_WORDCOUNT
CHARCOUNT 16 PIDSI_CHARCOUNT
THUMBNAIL 17 PIDSI_THUMBNAIL
APPNAME 18 PIDSI_APPNAME
DOC_SECURITY 19 PIDSI_DOC_SECURITY
TITLE 2 PIDSI_TITLE
SUBJECT 3 PIDSI_SUBJECT
AUTHOR 4 PIDSI_AUTHOR
KEYWORDS 5 PIDSI_KEYWORDS
COMMENTS 6 PIDSI_COMMENTS
TEMPLATE 7 PIDSI_TEMPLATE
LASTAUTHOR 8 PIDSI_LASTAUTHOR
REVNUMBER 9 PIDSI_REVNUMBER
PIDDSI
Name Val Win32
MMCLIPCOUNT 10 PIDDSI_MMCLIPCOUNT
SCALE 11 PIDDSI_SCALE
HEADINGPAIR 12 PIDDSI_HEADINGPAIR
DOCPARTS 13 PIDDSI_DOCPARTS
MANAGER 14 PIDDSI_MANAGER
COMPANY 15 PIDDSI_COMPANY
LINKSDIRTY 16 PIDDSI_LINKSDIRTY
CATEGORY 2 PIDDSI_CATEGORY
PRESFORMAT 3 PIDDSI_PRESFORMAT
BYTECOUNT 4 PIDDSI_BYTECOUNT
LINECOUNT 5 PIDDSI_LINECOUNT
PARCOUNT 6 PIDDSI_PARCOUNT
SLIDECOUNT 7 PIDDSI_SLIDECOUNT
NOTECOUNT 8 PIDDSI_NOTECOUNT
HIDDENCOUNT 9 PIDDSI_HIDDENCOUNT
PIDMSI
Name Val Win32
PRODUCTION 10 PIDMSI_PRODUCTION
COPYRIGHT 11 PIDMSI_COPYRIGHT
EDITOR 2 PIDMSI_EDITOR
SUPPLIER 3 PIDMSI_SUPPLIER
SOURCE 4 PIDMSI_SOURCE
SEQUENCE_NO 5 PIDMSI_SEQUENCE_NO
PROJECT 6 PIDMSI_PROJECT
STATUS 7 PIDMSI_STATUS
OWNER 8 PIDMSI_OWNER
RATING 9 PIDMSI_RATING
PIDASI
Name Val Win32
COMPRESSION 10 PIDASI_COMPRESSION
FORMAT 2 PIDASI_FORMAT
TIMELENGTH 3 PIDASI_TIMELENGTH
AVG_DATA_RATE 4 PIDASI_AVG_DATA_RATE
SAMPLE_RATE 5 PIDASI_SAMPLE_RATE
SAMPLE_SIZE 6 PIDASI_SAMPLE_SIZE
CHANNEL_COUNT 7 PIDASI_CHANNEL_COUNT
STREAM_NUMBER 8 PIDASI_STREAM_NUMBER
STREAM_NAME 9 PIDASI_STREAM_NAME
PID_VOLUME
Name Val Win32
FREE 2 PID_VOLUME_FREE
CAPACITY 3 PID_VOLUME_CAPACITY
FILESYSTEM 4 PID_VOLUME_FILESYSTEM
SHCONTF
Name Val Win32
SHAREABLE 1024 SHCONTF_SHAREABLE
INCLUDEHIDDEN 128 SHCONTF_INCLUDEHIDDEN
STORAGE 2048 SHCONTF_STORAGE
INIT_ON_FIRST_NEXT 256 SHCONTF_INIT_ON_FIRST_NEXT
FOLDERS 32 SHCONTF_FOLDERS
NETPRINTERSRCH 512 SHCONTF_NETPRINTERSRCH
NONFOLDERS 64 SHCONTF_NONFOLDERS
SHGDN
Name Val Win32
NORMAL 0 SHGDN_NORMAL
INFOLDER 1 SHGDN_INFOLDER
FORADDRESSBAR 16384 SHGDN_FORADDRESSBAR
FORPARSING 32768 SHGDN_FORPARSING
FOREDITING 4096 SHGDN_FOREDITING
INCLUDE_NONFILESYS 8192 SHGDN_INCLUDE_NONFILESYS
SLGP
Name Val Win32
SHORTPATH 1 SLGP_SHORTPATH
UNCPRIORITY 2 SLGP_UNCPRIORITY
RAWPATH 4 SLGP_RAWPATH

Exceptions

exception x_shell(errno=None, errctx=None, errmsg=None)

References

See also

cookbook/shell
Cookbook examples of using the shell module

Table Of Contents

This Page