<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="IncrediMail 1.0" name=GENERATOR></HEAD>
<BODY style="BACKGROUND-POSITION: 0px 0px; FONT-SIZE: 10pt; MARGIN: 0px 10px 10px; BACKGROUND-REPEAT: no-repeat; FONT-FAMILY: Verdana" bgProperties=fixed bgColor=#ffffff background="" scroll=yes SIGCOLOR="0" INCREDIFIXEDFORIMOL="true" ORGYPOS="0">
<TABLE id=INCREDIMAINTABLE cellSpacing=0 cellPadding=2 width="100%" border=0>
<TBODY>
<TR>
<TD id=INCREDITEXTREGION style="FONT-SIZE: 10pt; CURSOR: auto" vAlign=top width="100%">
<DIV>Thank You! I have also found this:</DIV>
<DIV> </DIV>
<DIV>Always Use Parentheses to Call a Function</DIV>
<DIV>You must add parentheses after a function name to call it, whether it takes arguments or not. That is, use function(), not function. Python functions are simply objects that have a special operation, a call, that you trigger with the parentheses. Like all objects, they can also be assigned to variables, and used indirectly: x = function; x().</DIV>
<DIV>In Python training, this seems to occur most often with files. It's common to see beginners type file.close to close a file, rather than file.close(); because it's legal to reference a function without calling it, the first version without parenthesis succeeds silently, but does not close the file!</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Regards,</DIV>
<DIV>Aleksandar</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV id=IncrediOriginalMessage><I>-------Original Message-------</I></DIV>
<DIV> </DIV>
<DIV id=receivestrings>
<DIV dir=ltr style="FONT-SIZE: 11pt"><I><B>From:</B></I> <A href="mailto:python-win32-request@python.org">python-win32-request@python.org</A></DIV>
<DIV dir=ltr style="FONT-SIZE: 11pt"><I><B>Date:</B></I> 04/10/06 12:03:16</DIV>
<DIV dir=ltr style="FONT-SIZE: 11pt"><I><B>To:</B></I> <A href="mailto:python-win32@python.org">python-win32@python.org</A></DIV>
<DIV dir=ltr style="FONT-SIZE: 11pt"><I><B>Subject:</B></I> Python-win32 Digest, Vol 37, Issue 10</DIV></DIV>
<DIV> </DIV>
<DIV>Send Python-win32 mailing list submissions to</DIV>
<DIV> <A href="mailto:python-win32@python.org">python-win32@python.org</A></DIV>
<DIV> </DIV>
<DIV>To subscribe or unsubscribe via the World Wide Web, visit</DIV>
<DIV> <A href="http://mail.python.org/mailman/listinfo/python-win32">http://mail.python.org/mailman/listinfo/python-win32</A></DIV>
<DIV>or, via email, send a message with subject or body 'help' to</DIV>
<DIV> <A href="mailto:python-win32-request@python.org">python-win32-request@python.org</A></DIV>
<DIV> </DIV>
<DIV>You can reach the person managing the list at</DIV>
<DIV> <A href="mailto:python-win32-owner@python.org">python-win32-owner@python.org</A></DIV>
<DIV> </DIV>
<DIV>When replying, please edit your Subject line so it is more specific</DIV>
<DIV>than "Re: Contents of Python-win32 digest..."</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Today's Topics:</DIV>
<DIV> </DIV>
<DIV> 1. Re: Code help (Roger Upole)</DIV>
<DIV> 2. Re: Code help (Aleksandar Cikota) (Justin Ezequiel)</DIV>
<DIV> 3. Re: Code help (<A href="mailto:timr@probo.com">timr@probo.com</A>)</DIV>
<DIV> 4. Re: Code help (Aleksandar Cikota) (Bob Gailer)</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>----------------------------------------------------------------------</DIV>
<DIV> </DIV>
<DIV>Message: 1</DIV>
<DIV>Date: Sun, 9 Apr 2006 06:54:32 -0400</DIV>
<DIV>From: "Roger Upole" <<A href="mailto:rwupole@msn.com">rwupole@msn.com</A>></DIV>
<DIV>Subject: [python-win32] Re: Code help</DIV>
<DIV>To: <<A href="mailto:python-win32@python.org">python-win32@python.org</A>></DIV>
<DIV>Message-ID: <<A href="mailto:BAY0-SMTP04AD9A9830BFC06CD79CABA3CF0@phx.gbl">BAY0-SMTP04AD9A9830BFC06CD79CABA3CF0@phx.gbl</A>></DIV>
<DIV>Content-Type: text/plain; format=flowed; charset="iso-8859-1";</DIV>
<DIV> reply-type=original</DIV>
<DIV> </DIV>
<DIV>Aleksandar Cikota wrote:</DIV>
<DIV> </DIV>
<DIV>> Python code:</DIV>
<DIV>> import win32com.client</DIV>
<DIV>> FM = win32com.client.Dispatch('FocusMax.FocusControl')</DIV>
<DIV>> FM.Focus</DIV>
<DIV> </DIV>
<DIV>Use FM.Focus().</DIV>
<DIV>You need the parens to actually call the function.</DIV>
<DIV>In Python, FM.Focus just returns a reference to the Focus</DIV>
<DIV>method rather than calling the method.</DIV>
<DIV> </DIV>
<DIV> hth</DIV>
<DIV> Roger</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>------------------------------</DIV>
<DIV> </DIV>
<DIV>Message: 2</DIV>
<DIV>Date: Mon, 10 Apr 2006 10:13:08 +0800</DIV>
<DIV>From: "Justin Ezequiel" <<A href="mailto:justin.mailinglists@gmail.com">justin.mailinglists@gmail.com</A>></DIV>
<DIV>Subject: Re: [python-win32] Code help (Aleksandar Cikota)</DIV>
<DIV>To: <A href="mailto:python-win32@python.org">python-win32@python.org</A></DIV>
<DIV>Message-ID:</DIV>
<DIV> <<A href="mailto:3c6718980604091913y2f35ca35n9d5d7871015e8832@mail.gmail.com">3c6718980604091913y2f35ca35n9d5d7871015e8832@mail.gmail.com</A>></DIV>
<DIV>Content-Type: text/plain; charset=ISO-8859-1</DIV>
<DIV> </DIV>
<DIV>FocusMax.FocusControl.Focus starts the auto focus operation and returns when</DIV>
<DIV>Focus is complete. This Method has the same effect as if the user clicked</DIV>
<DIV>the Focus button on the Focus tab (in FocusMax), but there is no reaction</DIV>
<DIV>and I don't get any error message.</DIV>
<DIV> </DIV>
<DIV>Python code:</DIV>
<DIV>FM.Focus() # you need the parentheses to call the method</DIV>
<DIV> </DIV>
<DIV>in VBScript, the parentheses are not required</DIV>
<DIV> </DIV>
<DIV>I sometimes forget the parentheses too when porting VB COM code to Python</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>------------------------------</DIV>
<DIV> </DIV>
<DIV>Message: 3</DIV>
<DIV>Date: Sun, 9 Apr 2006 21:24:54 -0700</DIV>
<DIV>From: <A href="mailto:timr@probo.com">timr@probo.com</A></DIV>
<DIV>Subject: Re: [python-win32] Code help</DIV>
<DIV>To: <A href="mailto:python-win32@python.org">python-win32@python.org</A></DIV>
<DIV>Cc: Tim Roberts <<A href="mailto:timr@probo.com">timr@probo.com</A>></DIV>
<DIV>Message-ID: <<A href="mailto:20060409212454.A21611@probo.com">20060409212454.A21611@probo.com</A>></DIV>
<DIV>Content-Type: text/plain; charset=us-ascii</DIV>
<DIV> </DIV>
<DIV>On Sun, 9 Apr 2006 11:41:02, "Aleksandar Cikota" <<A href="mailto:alexci@gmx.net">alexci@gmx.net</A>> wrote:</DIV>
<DIV>></DIV>
<DIV>></DIV>
<DIV>> FocusMax.FocusControl.Focus starts the auto focus operation and returns when</DIV>
<DIV>> Focus is complete. This Method has the same effect as if the user clicked</DIV>
<DIV>> the Focus button on the Focus tab (in FocusMax), but there is no reaction</DIV>
<DIV>> and I don't get any error message.</DIV>
<DIV>></DIV>
<DIV>> It works in Visual Basic Script, I have tryed it, but it doesn't work in</DIV>
<DIV>> Python. Why? I'm a beginner in programming and I hope that You can help me.</DIV>
<DIV>> I have send you a part of the code in Python. It should work, but it doesn't</DIV>
<DIV>></DIV>
<DIV>> Python code:</DIV>
<DIV>> import win32com.client</DIV>
<DIV>> FM = win32com.client.Dispatch('FocusMax.FocusControl')</DIV>
<DIV>> FM.Focus</DIV>
<DIV>></DIV>
<DIV>> VBScript (that works):</DIV>
<DIV>> Set FM = CreateObject("FocusMax.FocusControl")</DIV>
<DIV>> FM.Focus</DIV>
<DIV> </DIV>
<DIV>VB allows you to use a shortcut to call functions with no parameters, by</DIV>
<DIV>omitting the parentheses. Python does not. You need to use:</DIV>
<DIV> </DIV>
<DIV> FM.Focus()</DIV>
<DIV>--</DIV>
<DIV>- Tim Roberts, <A href="mailto:timr@probo.com">timr@probo.com</A></DIV>
<DIV> Providenza & Boeklheide, Inc.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>------------------------------</DIV>
<DIV> </DIV>
<DIV>Message: 4</DIV>
<DIV>Date: Sun, 09 Apr 2006 22:36:45 -0700</DIV>
<DIV>From: Bob Gailer <<A href="mailto:bgailer@alum.rpi.edu">bgailer@alum.rpi.edu</A>></DIV>
<DIV>Subject: Re: [python-win32] Code help (Aleksandar Cikota)</DIV>
<DIV>To: Justin Ezequiel <<A href="mailto:justin.mailinglists@gmail.com">justin.mailinglists@gmail.com</A>></DIV>
<DIV>Cc: <A href="mailto:python-win32@python.org">python-win32@python.org</A></DIV>
<DIV>Message-ID: <<A href="mailto:4439EEED.6050401@alum.rpi.edu">4439EEED.6050401@alum.rpi.edu</A>></DIV>
<DIV>Content-Type: text/plain; charset=ISO-8859-1; format=flowed</DIV>
<DIV> </DIV>
<DIV>Justin Ezequiel wrote:</DIV>
<DIV>> FocusMax.FocusControl.Focus starts the auto focus operation and returns when</DIV>
<DIV>> Focus is complete. This Method has the same effect as if the user clicked</DIV>
<DIV>> the Focus button on the Focus tab (in FocusMax), but there is no reaction</DIV>
<DIV>> and I don't get any error message.</DIV>
<DIV>></DIV>
<DIV>> Python code:</DIV>
<DIV>> FM.Focus() # you need the parentheses to call the method</DIV>
<DIV>></DIV>
<DIV>> in VBScript, the parentheses are not required</DIV>
<DIV>></DIV>
<DIV>This also points out a strength of Python over VB: Python lets one refer</DIV>
<DIV>to function objects. VB does not. I can for example create a list or</DIV>
<DIV>dictionary of functions.</DIV>
<DIV>> I sometimes forget the parentheses too when porting VB COM code to Python</DIV>
<DIV>> _______________________________________________</DIV>
<DIV>> Python-win32 mailing list</DIV>
<DIV>> <A href="mailto:Python-win32@python.org">Python-win32@python.org</A></DIV>
<DIV>> <A href="http://mail.python.org/mailman/listinfo/python-win32">http://mail.python.org/mailman/listinfo/python-win32</A></DIV>
<DIV>></DIV>
<DIV>></DIV>
<DIV>></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>------------------------------</DIV>
<DIV> </DIV>
<DIV>_______________________________________________</DIV>
<DIV>Python-win32 mailing list</DIV>
<DIV><A href="mailto:Python-win32@python.org">Python-win32@python.org</A></DIV>
<DIV><A href="http://mail.python.org/mailman/listinfo/python-win32">http://mail.python.org/mailman/listinfo/python-win32</A></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>End of Python-win32 Digest, Vol 37, Issue 10</DIV>
<DIV>********************************************</DIV>
<DIV> </DIV>
<DIV> </DIV></TD></TR>
<TR>
<TD id=INCREDIFOOTER width="100%">
<TABLE cellSpacing=0 cellPadding=0 width="100%">
<TBODY>
<TR>
<TD width="100%"></TD>
<TD id=INCREDISOUND vAlign=bottom align=middle></TD>
<TD id=INCREDIANIM vAlign=bottom align=middle></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></BODY></HTML>