[Tutor] Add metadata to a dir of files.

Tim Golden mail at timgolden.me.uk
Thu Feb 22 21:16:21 CET 2007


Mark Bystry wrote:
> getting even closer. figure out how to write to a file but still in vbscript.
> 
> dsofile_write.vbs
> code:
> Set objFile = CreateObject("DSOFile.OleDocumentProperties")
> objFile.Open("D:\test.txt")
> objFile.SummaryProperties.Category = "CAT54"
> objFile.Save

In Python, that's spelt:

<code>
import win32com.client
props = win32com.client.Dispatch ("DSOFile.OleDocumentProperties")
props.Open (r"c:\temp\test.txt")
props.SummaryProperties.Category = "CAT54"
props.Save ()

</code>

but when I tried doing it, I got a COM error on the line
where the Category is written. It worked ok with Subject
instead. Wouldn't have thought this was down to Python,
but I've not got much to go on!

TJG


More information about the Tutor mailing list