I have a few Visual Basic (VB) and VBScript programs I would like to convert
to Python, however some of them rely on named arguments and I'm wondering
whether there is an equivalent way to pass arguments to a COM method in
Python or whether there is a general Python syntax for doing named and/or
optional arguments?

The following VB and VBScript snippets show what I need to do.
in VB, given
  sub foo(x as int, y as int, z as int)
You can call it positionally like so:
  foo 1, 2, 3
or by parameter like so:
  foo z := 3, y := 2, x := 1
so given a COM method like FindControl where the optional arguments are
  FindControl([Type], [Id], [Tag], [Visible])
you could use something like this to find a control in Outlook
  Set oCtl = oOutlookApp.ActiveExplorer.CommandBars.FindControl(ID:=5488)
to find a specific control. In VBScript, which doesn't have the := syntax
you can just pass an empty argument to use the method positionally
  ...FindControl(, 5488)
See "named arguments" in the MSDN Library for more info.

The question becomes whether there is an equivalent syntax in Python for
either the named arguments or making a call similar to the VBScript one
above? I've tried doing some variations in Python such as:
  ...FindControl(None, 5488, None, None)
but they all generated errors.

ka
---
Kevin Altis
[EMAIL PROTECTED]

_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython

Reply via email to