pythoncom and writing file "summary" info on Windows

mattleftbody at gmail.com mattleftbody at gmail.com
Mon Jun 8 02:37:03 CEST 2009


Hello,
I was trying to put together a script that would write things like the
Author and Title metadata fields of a file under Windows.  I got the
win32 extensions installed and found a few things that look like they
should work, though I'm not getting the result I would expect.
Hopefully someone has worked through this area and can point me in the
right direction.

so after various imports I try the following:

file=pythoncom.StgOpenStorageEx(fname, m, storagecon.STGFMT_FILE, 0 ,
pythoncom.IID_IPropertySetStorage)

summ=file.Create(pythoncom.FMTID_SummaryInformation,
                      pythoncom.IID_IPropertySetStorage,
 
storagecon.PROPSETFLAG_DEFAULT,
storagecon.STGM_READWRITE|storagecon.STGM_CREATE|
storagecon.STGM_SHARE_EXCLUSIVE)

everything seems fine so far, until I try and write which doesn't seem
to do anything.  I tried the following three ways:

summ.WriteMultiple((storagecon.PIDSI_AUTHOR, storagecon.PIDSI_TITLE),
('Author', 'Title'))

summ.WriteMultiple((4,2 ), ('Author', 'Title'))

summ.WritePropertyNames((4,2 ), ('Author', 'Title'))


Any advice would be most appreciated!

Matt



More information about the Python-list mailing list