--- Thomas Heller <[EMAIL PROTECTED]> wrote:

> Ed Blake schrieb:
> > Yay, more problems!  Today i need to set a property of a specific object,
> > unfortunately I can't get the object because instead I am given a pointer
> to
> > a bound method.  I've poked around as much as I could, but I can't figure
> > this one out either.
> > 
> > The object is accessed thus:
> > Application.ActiveSettings.TextStyle
> > Application.ActiveSettings returns a pointer to an _Settings object
> > Here is the _Settings._methods_ entry for the property I want to access:
> > COMMETHOD([dispid(1610743823), 'propget'], HRESULT, 'TextStyle',
> >           ( ['retval', 'out'], POINTER(POINTER(_TextStyle)), 'pVal' )),
> > 
> > Here is the output and the error thrown:
> > <bound method POINTER(_Settings).TextStyle of <POINTER(_Settings) object
> > 2e2ec60>>
> > Traceback (most recent call last):
> >   File "G:\files\scripts\table.py", line 109, in <module>
> >     build_table(app, excel)
> >   File "G:\files\scripts\table.py", line 58, in build_table
> >     old_just = style.Justification
> > AttributeError: 'WinFunctionType' object has no attribute 'Justification'
> > 
> > I'm trying to retrieve the object, but the property can also be set to a
> new
> > object if that matters.
> 
> I'm convinced that properties work in principle.  This example code
> demonstrates
> setting properties with MS Word:
> 
> import comtypes.client
> 
> word = comtypes.client.CreateObject("Word.Application")
>         
> word.Visible = 1
> 
> doc = word.Documents.Add()
> wrange = doc.Range()
> for i in range(10):
>     wrange.InsertAfter("Hello from comtypes %d\n" % i)
> 
> for i, para in enumerate(doc.Paragraphs):
>             para.Range.Font.ColorIndex = i+1
>             para.Range.Font.Size = 12 + (2 * i)
>             para.Range.Font.Shading.Texture = -12
> 
> 
> What COM object are you using?  Is it possible for me to install it?
> Or can you try to reproduce this bug also with other objects?
> 

No, it is an application with all kinds of 'security' to prevent you from
using it.  In fact I can't use it right now because of a server issue!  I
will try to find a similar interface in a more public library.  My first
thought is that the deep nesting of properties is the cause though, like the
COM objects didn't get unwrapped at some point?  The other possibility is
that this is just another bugged interface in this buggy application I have
to use :rolleyes:

Ed Blake


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to