The GW-Scripting list is a discussion list for information regarding the development and use of Window-Eyes scripts. Any subscriber of the GW-Scripting list has the ability to post on-topic messages.

From:

 Tom Kingston <tom.kingston@charter.net>

Subject:

 Re: performing a single left mouse click?

Date:

 Sat, Mar 10, 2012 6:21:56 pm
And here's another oddity in VBScript. You can use parens if you use the
Call statement. So either of the following lines would work.
Call Mouse.Click(0, 1)
Mouse.Click 0, 1

Hth,
Tom



On 3/10/2012 12:03 PM, martin webster wrote:
> 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<doug.lee@ssbbartgroup.com> wrote:
>
>> From: Doug Lee<doug.lee@ssbbartgroup.com>
>> Subject: Re: performing a single left mouse click?
>> To: gw-scripting@gwmicro.com
>> 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:doug.lee@ssbbartgroup.com
>> http://www.ssbbartgroup.com
>> "While they were saying among themselves it cannot be done,
>> it was done." --Helen Keller
>>
>>
>
>