Re: [python-win32] Setting UserInitials in Office

2010-04-28 Thread Tim Golden

On 27/04/2010 22:43, Tim Roberts wrote:

Tim Golden wrote:

On 26/04/2010 23:56, Tim Roberts wrote:

Mike Driscoll wrote:

...
HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\UserInfo

I tried to use the base64 module to decode it, but I must be doing
something wrong. Does anyone know of a good way to get and set this
information? I am dealing with users on Windows XP and Python 2.4


???  The strings in there are not encoded in any way.  They are
plaintext Unicode strings.  They happen to be identified as REG_BINARY,
but that's just a silly accident.


On my (WinXP SP3, Office 2003) machine, they look to be utf16-encoded
strings (null-terminated):


Exactly.  They are really just REG_SZ, although they set the type as
REG_BINARY for their own inscrutable reasons.



Ah. Amazing how I managed to read your explanation and then internally
translate it into meaning something rather different.

Hopefully my code will have helped the OP out at any rate... I seem to be
having a bad week for offering help :)

TJG
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Setting UserInitials in Office

2010-04-28 Thread Mike Driscoll

On 1:59 PM, Tim Golden wrote:

On 27/04/2010 22:43, Tim Roberts wrote:

Tim Golden wrote:

On 26/04/2010 23:56, Tim Roberts wrote:

Mike Driscoll wrote:

...
HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\UserInfo

I tried to use the base64 module to decode it, but I must be doing
something wrong. Does anyone know of a good way to get and set this
information? I am dealing with users on Windows XP and Python 2.4


???  The strings in there are not encoded in any way.  They are
plaintext Unicode strings.  They happen to be identified as 
REG_BINARY,

but that's just a silly accident.


On my (WinXP SP3, Office 2003) machine, they look to be utf16-encoded
strings (null-terminated):


Exactly.  They are really just REG_SZ, although they set the type as
REG_BINARY for their own inscrutable reasons.



Ah. Amazing how I managed to read your explanation and then internally
translate it into meaning something rather different.

Hopefully my code will have helped the OP out at any rate... I seem to be
having a bad week for offering help :)

TJG



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:


('m\x00l\x00d\x00\x00\x00', 3)

So I had to change your last line to: print repr (res[0].decode (utf16))

I'll try setting the value later today since that's the main goal of 
this little project. I suppose I'll need to encode it in utf16 too. 
Thanks for the assist!


- Mike
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Setting UserInitials in Office

2010-04-28 Thread Tim Golden

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
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] how to get access to someone's else Outlook Calendar ?

2010-04-28 Thread Stef Mientki
hello,

I want to control a number Outlook Calendars from different persons,
and I have access privilges and can manipulate them through Outlook.
Now I want to control them through Python.

Writing an appointment to my own Calendar works well with the code below.
But I don't know how to get my college's Calendar.
I tried with the Logon command,
but get the following error
  File D:\Data_Python_25\support\outlook_support.py, line 37, in module
print '2',oOutlook.Logon ( 'z904116', '', True, True )
  File P:\Python26\lib\site-packages\win32com\client\dynamic.py, line
512, in __getattr__
raise AttributeError(%s.%s % (self._username_, attr))
AttributeError: Outlook.Application.Logon

Any help would be much appreciated.
thanks,
Stef Mientki


from win32com.client import constants
import win32com.client
import time
import datetime

print ('Writing a new appointment')

import win32com.client
oOutlook = win32com.client.Dispatch(Outlook.Application)
#print '2',oOutlook.Logon ( 'z904116', '', True, True )
#print '2',oOutlook.Logon ( '', '', False, False )
appointment = oOutlook.CreateItem(1) # 1=outlook appointment item
appointment.Start = '2010-04-29 19:00'
appointment.Subject = 'Treintjes op zonne-energie'
appointment.Duration = 15
appointment.Location = 'Gooseberry Mesa'
appointment.Body = 'jdasds\njasdaskdas\nasdjsd\dnasdhasd\nhdhsjddasgduy'
appointment.Save()
appointment.ReminderMinutesBeforeStart = 15
#appointment.ReminderSet = true
#appointment.AllDayEvent = true
print done  #, dir (appointment)

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32