[jawsscripts] Re: Best way to click a button?

Then try to use the findDescendantWindow function to get the window
and send it a wm_click message.
Marlon

2008/9/26, Casey Mathews <csm120@xxxxxxxxxx>:
> Thanks, Yes the button only appears at one time, there aren't several
> buttons with the same control ID or label on screen at once. The control ID
> is constant. The problem still remains that with the if statement in place,
> it keeps evaluating to false even when the button is on screen.
>
>
> Casey Mathews
> Web Friendly Help | Demystifying Tech
> www.webfriendlyhelp.com
>
>
> ----- Original Message -----
> From: "Marlon Brandão de Sousa" <splyt.lists@xxxxxxxxx>
> To: <jawsscripts@xxxxxxxxxxxxx>
> Sent: Friday, September 26, 2008 9:38 AM
> Subject: [jawsscripts] Re: Best way to click a button?
>
>
>> Hmm ..
>> Perhaps finding the window using its control id. If it iis constant,
>> then it can be done relatively easily.
>> As soon as you get the desired window handle, just send a wm_click (if
>> I can recall it well) to it and you're done.
>> The only thing to pay atention on this is if the same button repeats
>> in several windows of the application at the same time. If this is
>> true, tjhen you'll have to select which one you want to send the
>> wm_click message to.
>> HTH,
>> Marlon
>>
>> 2008/9/26, Casey Mathews <csm120@xxxxxxxxxx>:
>>> Hello all. I am trying to find and click a preview button. This button
>>> always has the same control ID, and generally I can click the button with
>>>
>>> my
>>> script. If I put an if then statement in it, then the statement evaluates
>>>
>>> to
>>> false, even though the button is available. This button can appear in
>>> different windows within the program, and so I've been playing with find
>>> Descendant window, find window etc. If I leave the if statement out of
>>> the
>>> script, things work well, 90% of the time. Any tips as to how I could
>>> make
>>> this work better would be greatly appreciated.
>>> Code below.
>>> Script ClickPreviewButton ()
>>>
>>> If FindString (GetAppMainWindow (GetCurrentWindow ()), "preview",
>>> s_bottom,
>>> s_unrestricted) then
>>>
>>> LeftMouseButton ()
>>>
>>> PCCursor ()
>>>
>>> Else
>>>
>>> SayMessage (ot_error, "Preview button was not found", "Preview not
>>> found")
>>>
>>> EndIf
>>>
>>> EndScript
>>>
>>>
>>>
>>> Casey Mathews
>>> Web Friendly Help | Demystifying Tech
>>> www.webfriendlyhelp.com
>>>
>>>
>>> __________
>>> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>>>
>>> View the list's information and change your settings at
>>> http://www.freelists.org/list/jawsscripts
>>>
>>>
>>
>>
>> --
>> When you say "I wrote a program that crashed Windows," people just
>> stare at you blankly and say "Hey, I got those with the system, for
>> free."
>> Linus Torvalds
>> __________
>> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>>
>> View the list's information and change your settings at
>> http://www.freelists.org/list/jawsscripts
>>
>>
>
> __________
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
>
>


-- 
When you say "I wrote a program that crashed Windows," people just
stare at you blankly and say "Hey, I got those with the system, for
free."
Linus Torvalds
__________ 
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

Other related posts: