[python-win32] Setting UserInitials in Office

Mike Driscoll mdriscoll at co.marshall.ia.us
Mon May 3 17:31:46 CEST 2010


On 1:59 PM, Tim Golden wrote:
> On 28/04/2010 14:23, Mike Driscoll wrote:
>>
>> Sorry for the delay in checking this out. I was out of the office
>> yesterday. Your code almost worked for reading the key, but I get a
>> tuple back:
>
> [goes back to check what he wrote...]
>
> That's why my code does this (note the nearly-invisible
> underscore before the equals), discarding the datatype
> value which is the second item of the tuple returned:
>
> username, _ = _winreg.QueryValueEx (k, "UserName")
>
> TJG
>

Ah...I must have had something in my eye at the time. Anyway, I figured 
out how to get the information from it, but not how to write it. I tried 
writing to the Registry using _winreg.SetValueEx and passed a plain 
string and then various encoded strings (like utf16, utf32, etc). It 
writes just fine, but if I open Microsoft Word and check for the new 
initials or Full Name, Word just shows junk.

- Mike



More information about the python-win32 mailing list