1. Well, to give you a hint but not a solution, the properties are part of the OLE container format, which all Office documents share. I believe wvSummary can get them out, for instance (part of wvWare). There's a small handful of OLE libraries out there.

    But it's probably easier on Windows than on Unix. BuiltInDocumentProperties is what you are looking for, I believe. How exactly do you get it? Beats me, but I'm sure it would be easy using COM or some other such thing I don't really understand.
      posted by Ian Bicking at 11:05:33 PM on February 27, 2004  
  2. This zip file contains a C++ class which allows access to the compound document properties. It does so using a number of COM interfaces, which should be accessible through Python without too much work.

    Good luck!
      posted by Lao at 04:28:48 PM on February 28, 2004  
  3. I don't have a solution but a quick search on MSDN returned this link http://msdn.microsoft.com/library/default.asp?url=/library/en-us/stg/stg/the_summary_information_property_set.asp which explains how the properties are stored and how to read and write them using COM. Also this link http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/manage_summary_information.asp says that there is a VBscript in the Windows Platform SDK for Windows Installer (a free download) that can manage the properties of msi-files. I would not be surprised if this script also uses COM and could be used to manage properties of other files as well. So try the COM support in pywin32.
      posted by jlohr at 02:03:24 PM on February 29, 2004  
  4. If you install Mark Hammonds python extensions, you can call the COM methods used in the delphi page you point to. The package is found at http://starship.python.net/crew/mhammond/

    The following is the lines of python code I used to replicate the first function that gets the file system type.

    >>> import win32com.client
    >>> fso = win32com.client.Dispatch('Scripting.FileSystemObject')
    >>> drv = fso.GetDrive(fso.GetDriveName('d:\stack.py'))
    >>> drv.FileSystem
    u'NTFS'

    As you can see, using the win32 extensions from within python allows you to easily convert the delphi code to python. The rest shouldn't be much harder.
      posted by an anonymous coward at 05:07:47 AM on March 01, 2004  
  5. Microsoft provides an ActiveX component that you can use to read and modify document summary properties:

    http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q224/3/51.asp&NoWebContent;=1

    If you have Mark's extensions, you can easily get at the summary properties:

    import win32com.client

    reader = win32com.client.Dispatch("DSOFile.PropertyReader")
    doc = reader.GetDocumentProperties("some.doc")

    print doc.AppName ... etc

    I installed the dll by right clicking on dsofile.inf and selecting install.

    You also need to register the dll:
    regsvr32 c:\Windows\system32\dsofile.dll

    I generally use PythonWin's COM Makepy Utility (Tools menu) to generate the COM support files because it seems to be more reliable than not doing it.

    The library you want to run makepy on is:
    DS: OLE Document Properties 1.4 Object Library (1.4)


      posted by Brian Lenihan at 05:08:04 PM on March 01, 2004  
  6. Just wanted to add: I'm pretty sure that the Summary Property Sheet is an addition of the NTFS filesystem, thus it is not portable across to Fat32, this is something watch out for. Okay I was remembering halfway that there was stuff about this in Rebol one time, so I googled, I recalled correctly, the summary property sheet is specific to NTFS, implementing something called NTFS streams as discussed here: http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlZCSJ

    looks like a reasonable place to find some info on ntfs streams is at http://win32.mvps.org/

      posted by bryan at 10:48:02 AM on March 02, 2004  
  7. Just wanted to add: I'm pretty sure that the Summary Property Sheet is an addition of the NTFS filesystem, thus it is not portable across to Fat32, this is something watch out for. Okay I was remembering halfway that there was stuff about this in Rebol one time, so I googled, I recalled correctly, the summary property sheet is specific to NTFS, implementing something called NTFS streams as discussed here: http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlZCSJ

    looks like a reasonable place to find some info on ntfs streams is at http://win32.mvps.org/

      posted by bryan at 10:57:33 AM on March 02, 2004