-
Have a look at win32com\test\testStorage.py which extracts standard properties. It works with a file it's created itself, rather than a preexisting Office file, but in theory this should work more generally.
I couldn't get it to work myself, but I only spent 5 minutes or so. As usual with MS APIs, expect to spend hours searching MSDN to work out what the typo you made was :-(
Hope this helps.
-
In case anyone is interested,
I've a script that given a directory,
recurses down it and extracts the properties
of MS Word (Office?) files and outputs
it as HTML links (I think... cant remember).
Available via my home page under useless
scripts.
http://home.iprimus.com.au/ccang/scripts.html
Regards,
Chai
-
Mark Hammond gives a simple function for Office documents on http://groups.google.com/groups?selm=Tch9a.25371%24Xh1.60196%40news-server.bigpond.net.au&oe;=UTF-8&output;=gplain. Much better than opening Excel/Word for every file, IMHO.
His book, Python Programming on Windows 32, is highly recommended.
-
Not 100% sure (but almost):
http://www.microsoft.com/technet/community/scriptcenter/filefolder/scrff63.mspx
in py:
1) use genpy in "Microsoft Shell Controls And Automation", {50A7E9B0-70EF-11D1-B75A-00A0C90564FE} (shell32.dll)
2) by hand:
first:
from win32com.client import *;
objShell = Dipatch("Shell.Application");
objFolder = objShell.Namespace ("X:\\your-path");
to get the properties names (not their values):
objFolder.GetDetailsOf('', int-from-0-to-37);
to get the files from the folder:
objFolder.Items(); (<- array)
finally (for the first item...):
for x in range(30):
print objFolder.GetDetailsOf(objFolder.Items()[0], x);
There are other (simpler for just one file) ways:
objShell = Dipatch("Shell.Application");
objFolder = objShell.Namespace(0);
fInfo = objFolder.ParseName('complete-path-to-your file');
objFolder.GetDetailsOf(fInfo,int-idx-of-property)
but AFAIK 'ParseName' don't get the 'Extended Properties'
- - - - - - - -
Hope that helps you...