Setting boolean COM properties

Wiwih Gunadi wcanopy at covad.net
Tue Feb 13 19:14:46 EST 2001


I see, in that case, the problem lies with the COM object property,
specifically:

Word.Application.ActiveDocument.Footnotes.Item(1).Range.TextRetrievalMode.In
cludeFieldCodes

In the msdn documentation, this property is read-write, but no matter what I
assign to it, it won't change value.

Anybody has different experience with this?

-Will--

"Mark Hammond" <MarkH at ActiveState.com> wrote in message
news:3A88E346.2080106 at ActiveState.com...> Wiwih Gunadi wrote:
>
>
> > Does anybody know how to set a boolean COM object property?
> > In his book, Mark indicated two objects PyTrue and PyFalse but he didn't
> > tell how to get these objects.
> >
> > Searching the internet yields dissapointing results leading me to
believe
> > that these objects are obsolete or nobody ever use'em.
>
> You can just use integers 1 and 0, and they should work fine.
>
> PyTrue and PyFalse are hidden objects.  You can get at them via:
>
> true = 1==1
> false = 1==0
>
> Due to a quirk in Python, these variables will then look like ints, but
> are really the PyTrue and PyFalse objects, as shown here:
>
>  >>> true = 1==1
>  >>> true
> 1
>  >>> true == 1
> 1
>  >>> true is 1
> 0
>  >>>
>
> HTH,
>
> Mark.
>





More information about the Python-list mailing list