If you use makepy generated code, it should be possible. You will probably
need to change the top of the generated makepy file - change the
"Default...Arg" values to one of the other candidates mentioned.
Unfortunately I don't have it open right now and don't have the time to
look. This has come up a few times on the newsgroup, so google should also
find some hits.
Mark.
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Kevin
> Altis
> Sent: Wednesday, 23 May 2001 2:40 AM
> To: [EMAIL PROTECTED]
> Subject: named and optional arguments in Python for use with COM
> components?
>
>
> 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
_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython