[python-win32] Code help

timr at probo.com timr at probo.com
Mon Apr 10 06:24:54 CEST 2006


On Sun, 9 Apr 2006 11:41:02, "Aleksandar Cikota" <alexci at gmx.net> wrote:
>  
>  
> FocusMax.FocusControl.Focus starts the auto focus operation and returns when
> Focus is complete. This Method has the same effect as if the user clicked
> the Focus button on the Focus tab (in FocusMax), but there is no reaction
> and  I don't get any error message.
> 
> It works in Visual Basic Script, I have tryed it, but it doesn't work in
> Python. Why? I'm a beginner in programming and I hope that You can help me. 
> I have send you a part of the code in Python. It should work, but it doesn't
> 
> Python code:
> import win32com.client
> FM = win32com.client.Dispatch('FocusMax.FocusControl')
> FM.Focus
> 
> VBScript (that works):
> Set FM = CreateObject("FocusMax.FocusControl")
> FM.Focus

VB allows you to use a shortcut to call functions with no parameters, by
omitting the parentheses.  Python does not.  You need to use:

    FM.Focus()
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boeklheide, Inc.


More information about the Python-win32 mailing list