Thanks Doug and vic,
That does it, all though it's a fussy little line of code as if you don't 
include a space between Click and 0 VBScript flags the error "object doesn't 
support this property or method."
Warm regards.
Martin Webster.


--- On Sat, 3/10/12, Doug Lee <[email protected]> wrote:

> From: Doug Lee <[email protected]>
> Subject: Re: performing a single left mouse click?
> To: [email protected]
> Date: Saturday, March 10, 2012, 4:34 PM
> You have encountered what I regard as
> a rather confusing point in
> VBScript syntax.
> 
> When calling a function and assigning its result to
> something, you
> parenthesize the function's arguments:
> 
> x = myFunc(1,2,3)
> 
> But when you call a sub, you don't use parens:
> 
> mySub 1, 2, 3
> 
> Now it just so happens that a single-argument sub call will
> accept
> parens anyway:
> 
> mySub(1)
> 
> and
> 
> mySub 1
> 
> do pretty much the same thing.
> 
> Well almost...
> 
> Putting parens around a single argument forces it to be
> passed by
> value rather than by reference. So
> 
> mySub(x)
> 
> passes x by value, whereas
> 
> mySub x
> 
> can pass x by reference.
> 
> This confuses people though, because you can see mySub(x) in
> someone's
> code, assume that means parens are acceptable, try mySub(x,
> y), and
> find out there's a hole in that logic. mySub(x), (y) would
> work,
> pointless though that probably is for most applications.
> 
> Hth.
> 
> On Sat, Mar 10, 2012 at 08:17:40AM -0800, martin webster
> wrote:
> Hi all,
> I am trying to perform a single left mouse button click, so
> I open notepad, move the mouse to the "I" in file menu, open
> the immediate mode app, and issue the following line of
> VBScript:
> Mouse.Click(0, 1)
> I get the following error cannot use parenthesis when
> calling a sub. What's wrong with the line of code above.
> When looking at the mouse object Click method there are
> parentheses in the method's break down.
> Warm regards.
> Martin webster.
> 
> -- 
> Doug Lee, Senior Accessibility Programmer
> SSB BART Group - Accessibility-on-Demand
> mailto:[email protected] 
> http://www.ssbbartgroup.com
> "While they were saying among themselves it cannot be done,
> it was done." --Helen Keller
> 
>

Reply via email to