[jawsscripts] Re: Sending a Keystroke To A control

  • From: "Snowman" <snowman@xxxxxxxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Thu, 29 Nov 2018 17:35:15 -0600

Giving this sample a try on the problem slider, and the slider returns null 
when you ask it for the rangeValuePattern.
It says the only patterns supported are the value pattern, and the legacy 
iAccessible pattern.
And, you asked earlier, whether I had tried other key strokes,  and focus 
leaves the slider if you press any of those arrow keys.
I think there is another reason why that is happening, which is out of my 
control, and is what is making me explore this.

But, thanks for this sample.  Very instructive.




+--------------------------------------------------------------------------+
Listen to The Snowman on MushroomFM.com, Saturday evenings, 8PM Eastern 
time.
60's and 70's tunes, and gently conservative talk.

----- Original Message ----- 
From: "Udo Egner-Walter" <udo.egner-walter@xxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Thursday, November 29, 2018 11:53 AM
Subject: [jawsscripts] Re: Sending a Keystroke To A control


Hello Snowman,
here's another possible solution, this time by using UIA. This code
example searches for the first slider ("FindFirst"). If you have several
sliders you can adjust it and use "FindAll".

Hope this helps

Udo

<code start>

Script ChangeSliderPos ()

var

object oUIA,

object oElement,

object oCondition,

object oRangePattern,

string sValue,

handle hDialog

hDialog = GetRealWindow(GetFocus())

oUIA = CreateObjectEx ("FreedomSci.UIA", 0, "UIAScriptAPI.x.manifest")

oElement = oUIA.GetElementFromHandle (hDialog)

If !oElement then Return EndIf

oCondition = oUIA.CreateIntPropertyCondition(UIA_ControlTypePropertyId,
UIA_SliderControlTypeId)

If !oCondition then Return EndIf

; search the first slider

oElement = oElement.FindFirst (TreeScope_Descendants, oCondition)

If !oElement then Return EndIf

oRangePattern = oElement.GetRangeValuePattern()

SayString (oRangePattern.Value)

; you can also get the minimum and maximum values

; or other properties (you can have a look at the UIA documentation from
FS)

; SayString (oRangePattern.Maximum)

; SayString (oRangePattern.Minimum)

; set the new value here

oRangePattern.SetValue (oRangePattern.Value -5 )

; to get the new values search for slider again

oElement = oElement.FindFirst (TreeScope_Descendants,
oCondition).BuildUpdatedCache

oRangePattern = oElement.GetRangeValuePattern()

SayString (oRangePattern.Value)

EndScript

<code end>


Am 28.11.18 um 20:40 schrieb Udo Egner-Walter:

Hi Snowman,

did you try other key strokes on the control? Sometimes it's not the
arrow keys but page up and page down keys.

I don't know if SendMessage and PostMessage are working here. Some time
ago I searched the web for the same reason. I tried a few examples but
failed to send the keys to a control with SendMessage and PostMessage.

Good luck

Udo


Am 27.11.18 um 23:06 schrieb Snowman:
Guys, is it possible to send a particualr key stroke to a particular
control?
I have a case where the control takes focus, it is a slidere. But,
if you use the arrow keys, focus leaves the slider, and goes
elsewhere. I want to try sending the up and down arrow message to
the slider directly, to see if it will honor it.
I pressume this is SendMessage, or Post Message. but, I'm not sure
what to specify in the call.
Any help much appreciated.


+--------------------------------------------------------------------------+

Listen to The Snowman on MushroomFM.com, Saturday evenings, 8PM
Eastern time.
60's and 70's tunes, and gently conservative talk.

__________�

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

__________�

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



__________�

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

__________�

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

Other related posts: