<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>&nbsp;</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>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Regards,</DIV>
<DIV>Aleksandar</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV id=IncrediOriginalMessage><I>-------Original Message-------</I></DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV>Send Python-win32 mailing list submissions to</DIV>
<DIV>&nbsp; <A href="mailto:python-win32@python.org">python-win32@python.org</A></DIV>
<DIV>&nbsp;</DIV>
<DIV>To subscribe or unsubscribe via the World Wide Web, visit</DIV>
<DIV>&nbsp; <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>&nbsp; <A href="mailto:python-win32-request@python.org">python-win32-request@python.org</A></DIV>
<DIV>&nbsp;</DIV>
<DIV>You can reach the person managing the list at</DIV>
<DIV>&nbsp; <A href="mailto:python-win32-owner@python.org">python-win32-owner@python.org</A></DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Today's Topics:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp; 1.&nbsp;&nbsp;Re: Code help (Roger Upole)</DIV>
<DIV>&nbsp;&nbsp; 2. Re: Code help (Aleksandar Cikota) (Justin Ezequiel)</DIV>
<DIV>&nbsp;&nbsp; 3. Re: Code help (<A href="mailto:timr@probo.com">timr@probo.com</A>)</DIV>
<DIV>&nbsp;&nbsp; 4. Re: Code help (Aleksandar Cikota) (Bob Gailer)</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>----------------------------------------------------------------------</DIV>
<DIV>&nbsp;</DIV>
<DIV>Message: 1</DIV>
<DIV>Date: Sun, 9 Apr 2006 06:54:32 -0400</DIV>
<DIV>From: "Roger Upole" &lt;<A href="mailto:rwupole@msn.com">rwupole@msn.com</A>&gt;</DIV>
<DIV>Subject: [python-win32]&nbsp;&nbsp;Re: Code help</DIV>
<DIV>To: &lt;<A href="mailto:python-win32@python.org">python-win32@python.org</A>&gt;</DIV>
<DIV>Message-ID: &lt;<A href="mailto:BAY0-SMTP04AD9A9830BFC06CD79CABA3CF0@phx.gbl">BAY0-SMTP04AD9A9830BFC06CD79CABA3CF0@phx.gbl</A>&gt;</DIV>
<DIV>Content-Type: text/plain; format=flowed; charset="iso-8859-1";</DIV>
<DIV>&nbsp; reply-type=original</DIV>
<DIV>&nbsp;</DIV>
<DIV>Aleksandar Cikota wrote:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&gt; Python code:</DIV>
<DIV>&gt; import win32com.client</DIV>
<DIV>&gt; FM = win32com.client.Dispatch('FocusMax.FocusControl')</DIV>
<DIV>&gt; FM.Focus</DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;hth</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Roger</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>------------------------------</DIV>
<DIV>&nbsp;</DIV>
<DIV>Message: 2</DIV>
<DIV>Date: Mon, 10 Apr 2006 10:13:08 +0800</DIV>
<DIV>From: "Justin Ezequiel" &lt;<A href="mailto:justin.mailinglists@gmail.com">justin.mailinglists@gmail.com</A>&gt;</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>&nbsp; &lt;<A href="mailto:3c6718980604091913y2f35ca35n9d5d7871015e8832@mail.gmail.com">3c6718980604091913y2f35ca35n9d5d7871015e8832@mail.gmail.com</A>&gt;</DIV>
<DIV>Content-Type: text/plain; charset=ISO-8859-1</DIV>
<DIV>&nbsp;</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&nbsp;&nbsp;I don't get any error message.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Python code:</DIV>
<DIV>FM.Focus() # you need the parentheses to call the method</DIV>
<DIV>&nbsp;</DIV>
<DIV>in VBScript, the parentheses are not required</DIV>
<DIV>&nbsp;</DIV>
<DIV>I sometimes forget the parentheses too when porting VB COM code to Python</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>------------------------------</DIV>
<DIV>&nbsp;</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 &lt;<A href="mailto:timr@probo.com">timr@probo.com</A>&gt;</DIV>
<DIV>Message-ID: &lt;<A href="mailto:20060409212454.A21611@probo.com">20060409212454.A21611@probo.com</A>&gt;</DIV>
<DIV>Content-Type: text/plain; charset=us-ascii</DIV>
<DIV>&nbsp;</DIV>
<DIV>On Sun, 9 Apr 2006 11:41:02, "Aleksandar Cikota" &lt;<A href="mailto:alexci@gmx.net">alexci@gmx.net</A>&gt; wrote:</DIV>
<DIV>&gt;</DIV>
<DIV>&gt;</DIV>
<DIV>&gt; FocusMax.FocusControl.Focus starts the auto focus operation and returns when</DIV>
<DIV>&gt; Focus is complete. This Method has the same effect as if the user clicked</DIV>
<DIV>&gt; the Focus button on the Focus tab (in FocusMax), but there is no reaction</DIV>
<DIV>&gt; and&nbsp;&nbsp;I don't get any error message.</DIV>
<DIV>&gt;</DIV>
<DIV>&gt; It works in Visual Basic Script, I have tryed it, but it doesn't work in</DIV>
<DIV>&gt; Python. Why? I'm a beginner in programming and I hope that You can help me.</DIV>
<DIV>&gt; I have send you a part of the code in Python. It should work, but it doesn't</DIV>
<DIV>&gt;</DIV>
<DIV>&gt; Python code:</DIV>
<DIV>&gt; import win32com.client</DIV>
<DIV>&gt; FM = win32com.client.Dispatch('FocusMax.FocusControl')</DIV>
<DIV>&gt; FM.Focus</DIV>
<DIV>&gt;</DIV>
<DIV>&gt; VBScript (that works):</DIV>
<DIV>&gt; Set FM = CreateObject("FocusMax.FocusControl")</DIV>
<DIV>&gt; FM.Focus</DIV>
<DIV>&nbsp;</DIV>
<DIV>VB allows you to use a shortcut to call functions with no parameters, by</DIV>
<DIV>omitting the parentheses.&nbsp;&nbsp;Python does not.&nbsp;&nbsp;You need to use:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;FM.Focus()</DIV>
<DIV>--</DIV>
<DIV>- Tim Roberts, <A href="mailto:timr@probo.com">timr@probo.com</A></DIV>
<DIV>&nbsp;&nbsp;Providenza &amp; Boeklheide, Inc.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>------------------------------</DIV>
<DIV>&nbsp;</DIV>
<DIV>Message: 4</DIV>
<DIV>Date: Sun, 09 Apr 2006 22:36:45 -0700</DIV>
<DIV>From: Bob Gailer &lt;<A href="mailto:bgailer@alum.rpi.edu">bgailer@alum.rpi.edu</A>&gt;</DIV>
<DIV>Subject: Re: [python-win32] Code help (Aleksandar Cikota)</DIV>
<DIV>To: Justin Ezequiel &lt;<A href="mailto:justin.mailinglists@gmail.com">justin.mailinglists@gmail.com</A>&gt;</DIV>
<DIV>Cc: <A href="mailto:python-win32@python.org">python-win32@python.org</A></DIV>
<DIV>Message-ID: &lt;<A href="mailto:4439EEED.6050401@alum.rpi.edu">4439EEED.6050401@alum.rpi.edu</A>&gt;</DIV>
<DIV>Content-Type: text/plain; charset=ISO-8859-1; format=flowed</DIV>
<DIV>&nbsp;</DIV>
<DIV>Justin Ezequiel wrote:</DIV>
<DIV>&gt; FocusMax.FocusControl.Focus starts the auto focus operation and returns when</DIV>
<DIV>&gt; Focus is complete. This Method has the same effect as if the user clicked</DIV>
<DIV>&gt; the Focus button on the Focus tab (in FocusMax), but there is no reaction</DIV>
<DIV>&gt; and&nbsp;&nbsp;I don't get any error message.</DIV>
<DIV>&gt;</DIV>
<DIV>&gt; Python code:</DIV>
<DIV>&gt; FM.Focus() # you need the parentheses to call the method</DIV>
<DIV>&gt;</DIV>
<DIV>&gt; in VBScript, the parentheses are not required</DIV>
<DIV>&gt;</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>&gt; I sometimes forget the parentheses too when porting VB COM code to Python</DIV>
<DIV>&gt; _______________________________________________</DIV>
<DIV>&gt; Python-win32 mailing list</DIV>
<DIV>&gt; <A href="mailto:Python-win32@python.org">Python-win32@python.org</A></DIV>
<DIV>&gt; <A href="http://mail.python.org/mailman/listinfo/python-win32">http://mail.python.org/mailman/listinfo/python-win32</A></DIV>
<DIV>&gt;</DIV>
<DIV>&gt;</DIV>
<DIV>&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>------------------------------</DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>End of Python-win32 Digest, Vol 37, Issue 10</DIV>
<DIV>********************************************</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</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>