Python / Active Scripting - Value Assignment - HELP

news.earthlink.net adeptus at onebox.com
Wed Mar 13 17:35:40 EST 2002


Thanks for your help... One thing I didn't think of at the time is the fact
that I was trying to call the script from a HTT file which is used for a
custom folder view in win2k.

>From within the HTT file, no matter what I try to assign to
ax.document.bgColor.Value the following error appears.

  TypeError: 'unicode' object has only read-only attributes (assign to
.Value)

When I do the same from within a regular HTML file, I don't get an error...
But setting the value doesn't seem to do anything. (which gives me the hunch
that the error is still there, just not being brought to anyones attention)
After I'm back on my own PC I'll look into geting the MS script debugger.

calling repr(ax.document.bgColor) rewards me with u'#808080'
(which corresponds to the gray background color) and a unicode str

My understanding of both Unicode and COM are not quite what they should be,
but your suggestion does confirm that the value is a unicode string.

I'm still hoping theres still some simple conversion trick I'm missing.

Thanks again for all your help and time (and especialy the libs
themselves)...

adeptus


"Mark Hammond" <mhammond at skippinet.com.au> wrote in message
news:3C8F5564.7020502 at skippinet.com.au...
> adeptus wrote:
> > OK...
> >
> > Within a script block of a HTML file, I can do the following:
> >
> > something = ax.document.bgColor
> > ax.document.write("Background color is %s:" %something)
>
> What does:
> ax.document.write("Background color is %r:" %something)
>
> show?  (%r == repr(ob))
>
> >
> > However, unlike all the Javascript and VB examples I see, I can't do
> > the
> > following:
> >
> > ax.document.bgColor = "#000000"
> >
> > I always get an error about unicode strings being read only.
>
> Post the exact error.
>
> You could try ax.document.bgColor.Value = "#0000" - expecially if the
> object repr() says "<com object>" instead of still being a string.
>
> Mark.
>
>





More information about the Python-list mailing list