[jawsscripts] KeyWaiting function and best results?

  • From: "Steve Spamer" <stevespamer68@xxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Wed, 24 Oct 2018 11:33:59 +0100

Hi folks.  A couple of weeks ago I was put on to the IsKeyWaiting function 
to achieve a specific objective.  My question is, has anyone got advice on 
the best/most optimal way to use this function for the scenario I face?

At the moment, I am really happy with how it's performing in both the below 
examples, but with 1 caveat, which I'll explain.

First the current example, followed by a slight change I've tried, along 
with how the app works and what behaviour I want...and this shows the 
caveat.

If (GetFocus() == GetArranger()) Then
If IsKeyWaiting () Then
    PassKeyThrough ()
    Return
        Else
;            TypeCurrentScriptKey ()
            SayPosition()
EndIf
EndIf

Ok, so in the above example, the user presses the right arrow key at a 
certain speed and they are move along a transport by 1 bar.
If that speed, I think, exceeds what the IsKeyWaiting function considers to 
be a key waiting, then it passes the key through, allowing the audio to be 
skipped without any influence from the script, which is the behaviour 
wanted, so for example, if they hold the key down.
The caveat is in this scenario, is that if the user presses very quickly, 
then the pass key through reduces the amount of thimes they press by 1.
So, if they press 10 times very quickly, the transport will report it's 
moved 9 times, as the pass key through is counted and that press.

What I want to avoid is the key to be in the KeyWaiting buffer, as this 
triggers things as if the script is typing the key and it slows things down, 
but equally, I want every press to be counted correctly.

So, I have also tried putting the TypeCurrentScript above the IsKeyWaiting, 
so:

If (GetFocus() == GetArranger()) Then
            TypeCurrentScriptKey ()
If IsKeyWaiting () Then
    PassKeyThrough ()
    Return
        Else
;            TypeCurrentScriptKey ()
            SayPosition()
EndIf
EndIf

This also works as I want, and it also reports correctly, but without this 
being tested on a number of different/less powerful machines, I have no idea 
if this the prefered method.

It's easy to say, but I just want to try and avoid this function slowing the 
movement down, without first releasing the scripts, as the testers I have 
all have machines that will handle both ways, so I currently don't have a 
way to see if this will have an impact on lesser machines.  I have tried 
looking for the IsKeyWaiting function, but I'm unable to find it, as I was 
thinking, maybe I would be able to adjust the time that the function waits, 
before it considers that the key is actually waiting.

So, in summary, when the user presses once, the type key is triggered and 
the position is spoken. If they press quickly or hold the key down, then the 
app is just doing it's default action with no influence from the scripts, 
but most importantly, positions are correctly reported according to how many 
times they pressed.  Does anyone know which of the examples written above 
would be the best way of attack, or if there is a different approach that 
will give me the results I want.  THX Steve.

Follow me on Twitter: @stevesax123
Visit the samplitude Access website. Jaws scripts for pro recording with 
Samplitude in Windows: www.samplitudeaccess.org.uk 

__________�

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

Other related posts: