[python-win32] Referring to default (unnamed) property

Andreas Holtz A.Holtz at gmx.net
Sun May 11 23:32:16 CEST 2014


Hi £ukasz,

when you use a COM-Interface via VB for example things like

foo.bar(0) = "foo"

are possible (as I just read these are properties).

In Python this syntax is not working. Instead, getters and setters are generated by PyWin.
I guess somewhere (probably in the files generated by Dispatch)
do.vars[param]
is implemented as
do.vars.Get(param)

Regards

Andreas

PS: Feel free to correct me, if I am wrong.

schrieb £ukasz Jakubowski am 10.05.2014 12:29:
> Self-reply...
>
> I got a bit confused actually, DOpus.vars is just like a bit broken list with extra methods/fields:
>
> After
> do.vars.Set('qqq',1)
> Then
> len(do.vars[0])
>    or
> do.vars[0]
>    works as expected, though not
> do.vars[0] = 'zzz'
>    or
> do.vars.append('yyy')
>
> I guess this is a matter of how Directory Opus implements and exposes objects to ActiveScripting and then how pywin interprets them. I will
> need just to learn it.
>
> Regards,
>
>
>
>> Hello,
>>
>> How do I refer to an unnamed property (like the one on this page:
>> http://www.gpsoft.com.au/help/opus11/index.html#!Documents/Scripting/Vars.htm)?
>>
>> str(type(DOpus.vars))
>> or
>> str(type(DOpus.vars(0)))
>> gives me:
>> <class 'win32com.client.dynamic.CDispatch'>
>>
>> I can access methods mentioned on the page without problems, but this default property is a mystery to me.
>>
>> Maybe related: str(DOpus.vars(0)) does not work as well, but DOpus.vars.Get('SomeSetVariable') works OK.
>>
>> TIA,
>>
>> Regards,
>> £ukasz
>> _______________________________________________
>> python-win32 mailing list
>> python-win32 at python.org
>> https://mail.python.org/mailman/listinfo/python-win32
>
>


More information about the python-win32 mailing list