简体   繁体   中英

Python win32com.client function with propput

I'm using win32com.client to write a little plugin, but I have a problem with set a property. The definition for the property or function is this:

[id(0x00000021), propget, helpstring("property SystemChannel")]
long SystemChannel(
                long lVEN, 
                long lDEV, 
                long lSVID, 
                long lSID);

[id(0x00000021), propput, helpstring("property SystemChannel")]
void SystemChannel(
                long lVEN, 
                long lDEV, 
                long lSVID, 
                long lSID, 
                [in] long rhs);

I have not problems with get the value, the next code work greats:

app = Dispatch("CmAVConfig.AudioConfig")   
self.speakerNumber = app.SystemChannel(self.glVid, self.glDid, self.glSvid, self.glsid)

But I can't set the value of the same property, I have tried using the next instructions and I get the errors below:

app = Dispatch("CmAVConfig.AudioConfig")       
app.SystemChannel(self.glVid, self.glDid, self.glSvid, self.glsid, self.speakerNumber)
ERROR: SystemChannel() takes at most 5 arguments (6 given)

//this one is from a working example using javascript
app.SystemChannel(self.glVid, self.glDid, self.glSvid, self.glsid) = self.speakerNumber
ERROR: SyntaxError: ("can't assign to function call", ('ooo.py', 56, None, 'app.SystemChannel(self.glVid, self.glDid, self.glSvid, self.glsid) = self.speakerNumber\n'))

如果为该库运行makepy(或使用win32com.client.gencache.EnsureDispatch),则应创建一个需要额外arg的SetSystemChannel方法。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM