MRAB wrote:
> News123 wrote:
>> r wrote:
>>> more *maybe useful dump?
>>>
>>>>>> for i in dev.Items:
>>>     for p in i.Properties:
>>>         if not p.IsReadOnly:
>>>             print p.Name, '->', p.Value
>>>
>> . . .
>>> Horizontal Resolution -> 200
>>> Vertical Resolution -> 200
>>> Horizontal Start Position -> 0
>> . . .
>>> Now how to set the values... hmmm?
>>>
> Well, according to that they /aren't/ read-only because it says:
> 
>     if not p.IsReadOnly:
>        ^^^
> 
Exactly they are NOT read only, which means they are supposed to be
writable.

the python code is
for p in i.Properties:
    if not.p.ISReadOnly:
        # if I'm here I'm supposed to change them, but how?


the C# code, which succeds changing the property is:
foreach (Property prop in item.Properties){
    if (prop.IsReadOnly) continue; // skip rest of loop
                                   // if property cannot
                                   // be modified
    // now change property
    if (prop.Name == "Horizontal Resolution")
    {
         IProperty iprop = (IProperty)prop;
         Object val = 75;
         iprop.set_Value(ref val);
    }
}



The main question is the correct python method to change the property

prop = 300 # doesn't work as it just replaces the property with an integer

prop.set_Value(res) # doesn't work as the method set_Value doesn't seem
to exist

> Traceback (most recent call last):
>   File "C:\WIA\scan_wia.py", line 41, in <module>
>     image = scan_image_wia()
>   File "C:\WIA\scan_wia.py", line 37, in scan_image_wia
>     image = transferImg(dev)
>   File "C:\WIA\scan_wia.py", line 27, in transferImg
>     setImgProps(item)
>   File "C:\WIA\scan_wia.py", line 20, in setImgProps
>     prop.set_Value(res)
>   File "C:\Python26\lib\site-packages\win32com\client\dynamic.py", line 512, 
> in
> __getattr__
>     raise AttributeError("%s.%s" % (self._username_, attr))
> AttributeError: <unknown>.set_Value


bye


N


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to