[jawsscripts] Re: Keyboard help

  • From: "Steve Spamer" <stevespamer68@xxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Mon, 8 Oct 2018 15:54:01 +0100

Yes it is, but you can switch sets to give you more flexibility with your 
script. So, it doesn't have to be another app, it can just be another 
window.

For example, when launching the midi editor in Samplitude, the main scripts 
will switch you over to midi editor scripts, and vice versa when you close 
the midi editor.  This frees up things, so that you are kind of unloading 
all the script from the main set and only using script that works directly 
in the midi editor.  It defintely improves perfoormance, as it's reducing 
the code that needs to be processed. Best steve.

-----Original Message----- 
From: Peter Torpey
Sent: Monday, October 8, 2018 3:30 PM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Keyboard help

Ah, I thought Bob's approach would have worked but maybe that is where my 
understanding is wrong.  I assumed that each JSS configuration had its own 
associated JSD file and thus its own associated descriptions and help. 
Maybe that is not right, but I thought that switching to another 
configuration was almost like you were in a new program or app running a 
whole new set of scripts.  However I've never tested this..

--Pete


-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx <jawsscripts-bounce@xxxxxxxxxxxxx> On 
Behalf Of Steve Spamer
Sent: Monday, October 8, 2018 3:52 AM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Keyboard help

Bob, each .jss doesn't have it's own keyboard help, it would just be much 
harder to manage.  Add to that, in many of these .jss files, 1 keystroke can 
have many different actions depending on what window you're in.  So, writing 
a description would mean a long verbose bit of text describing what that key 
does in all the windows, so I don't use that.  I switch to the keyboard help 
.jss and when you press a key, it tells you what it does in your current 
location.

Anyway, all works now, just need to add keys to the keyboard hook. Best 
Steve.

-----Original Message-----
From: Bob
Sent: Sunday, October 7, 2018 9:48 PM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Keyboard help

I guess you are manually switching between the jss files rather than the app 
being made up of lots of executables that do that work for you.

I haven’t tried it but you could probably test easier than I could try and 
set something up to work like you have it.

If a particular jss is in use I would expect the descriptions from the 
scripts inside that file to be spoken with keyboard help on.

If the standard actions are spoken from non scripted keystrokes then I would 
put up with that as those actions will still occur for those keystrokes and 
for the simplicity of not having to rewrite the descriptions!

Bob

On 7 Oct 2018, at 20:33, Steve Spamer <stevespamer68@xxxxxxxxx> wrote:

Hi Bob. Ok, I'll explain and maybe it will become clearer.

I have a number of .jss files/sets that make up the solution for the app.
So, I have a main.jss, a TrackManager.jss, an ObjectEditor.jss, a
SystemSettings.jss, a MidiEditor.jss etc etc etc.
The reason for the scripts being separated is to maximize the
efficiency of each set.  If all script was in 1 .jss, there is too
much script in specific functions and this affects the performance.
All sets work in conjunction with each other.

So, in the main.jss for example, control plus  1 will do 1 action in 1
window, another action in another window and so on. If it's the
normalization window, it does 1 thing, in the quantize window it does
another.
This is mirrored across all sets of scripts.

So, I created another .jss  that handles all keys for all .jss files,
called KeyboardHelp.
In this file I have scripts that speak the name of the key, depending
on what window it is in. For example:
Script Control1 ()
Var
   String strLocation

Let strLocation = getLocation()

SayCurrentScriptKeyLabel()

If IsVIPWindow(strLocation) Then
   Say what this key does in the VIP window ElIf
IsObjectEditor(strLocation) Then Say what this key does in the object
editor etc etc etc EndIf EndScript

This enables me to switch to this Keyboard Help.jss from any set and
get spoken feedback on each key, no matter what set was active.

Up until now I've been using a global to turn this fudged keyboard
help on/off. So, I'm in 1 set, insert 1 turns the global on and
switches to the keyboard help set.  Then, with each press of a key,
Jaws speaks what that key does in the window you're currently in, but
it doesn't stop you pressing a key that isn't scrpted.  If you do,
then that action will take place.

The objective is to speak what that key does, while not allowing any
other key that isn't scripted to be executed.  Now I'm using the
standard KeyboardHelp functions, I can switch to this set and no key
is executed, but all script keys are, I just need to add all the
scripted keys to the KeyboardHelpHook function.  Only down side will
be Jaws will speak what Jaws does, if it's a key not scripted and it
has a Jaws actions associated with it.

I know this maybe a huge fudge, but it's something I've done with the
knowledge I had.  Having only 1 script to handle what key does what
was the best way to go for me, as the whole solution has around 110
Jaws files.
Hope this gives you a clearer idea on things....and sorry if I've made
it worse lol. Best steve.

-----Original Message-----
From: Bob
Sent: Sunday, October 7, 2018 6:24 PM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Keyboard help

Steve

Just to make sure I’m understanding.
You want your keys included in the keyboard help?
Your not trying to only have yours and not the default ones spoken?

If so just go to your script:
Script MyScript
;some code
EndScript

Press control+d
Fill in the description boxes.

This will be spoken for keyboard help.

If your trying to do something different you may need to explain further.

Bob

On 7 Oct 2018, at 18:16, Steve Spamer <stevespamer68@xxxxxxxxx> wrote:

Hi Jonathan.  At the moment I'm using the standard keybaord help, but
with specific scripted keys included.  This means I have to add each
script and there's a few hundred, which is a pain.
Earlier today, I tried a method Udo posted, but I found keys were
being passed through the trap key function.  So, a scripted key was
OK, but a key native to the app that hadn't been assigned a script
still activated while in help mode.  Now, with the standard keyboard
help, all works OK, but I have to add all the keys I need.

Best steve.

-----Original Message-----
From: Jonathan Cohn
Sent: Sunday, October 7, 2018 6:03 PM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Keyboard help

I am confused  as to why you can’t use the standard jaws key help
functions from what you describe. So, I just want to make sure you
are aware that you can update the JAWS help file associated with a
specific script function and JAWS help can provide that information
when in JAWS key help mode Obviously if your functions need to be
more contextual, or you are attempting to to do other functionality
then carry on, but I want to make sure you are not attempting to just
reproduce code that would that is part of the standard functionality.

Take care,

Jonathan  Cohn
.
On Oct 7, 2018, at 11:11 AM, Steve Spamer <stevespamer68@xxxxxxxxx>
wrote:

Hi Udo.  The IsScriptKey function also requires the name of the
script to check.  So, specifying all keys is still necessary.  I
would have hoped that jaws was capable of knowing if a key is a
script or not, without having to specify them all first.

So, if the key you press has a script associated with it, then run
it, otherwise don't do anything. Best Steve.

-----Original Message-----
From: Udo Egner-Walter
Sent: Sunday, October 7, 2018 3:56 PM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Keyboard help

Hi Steve, hi Bob,

to check if a key is assigned to a script one can also use the
function IsScriptKey(). But I don't know how to stop it if TrapKeys
and the hook not working.

Reading for keys in the ini file is sensitive to errors because you
don't know if to search for "Control+Alt" or for "Alt+Control".

Udo



Am 07.10.2018 um 15:53 schrieb Steve Spamer:
Thanks Bob, that's an option.  I suppose I'm just trying to be
lazy, as this app has a few hundred scripted keys.  Either way I'm
going to have to specify the keys or specify what to look for.
Good news at the moment, I have it all working as I want it to,
just need to add the actual keys I want the help to recognize. THX
Steve.

-----Original Message-----
From: Bob
Sent: Sunday, October 7, 2018 2:35 PM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Keyboard help

Steve

You could use inireadstring on the jkm file to test if the
keystroke is in use for this app.

Bob

On 7 Oct 2018, at 13:44, Steve Spamer <stevespamer68@xxxxxxxxx> wrote:

Hi Udo.  I've tried the trap keys method and I'm still having
unscripted keys (application default/unscripted keys) executed.
Apart from that it works great.
I'll try the hook method and see if this makes any difference, as
I basically want it to work the same way the default keyboard help
works.
This doesn't allow any unscripted key to be exacuted The trap keys
method seems to me as if all possible combinations have to be
specified, rather than just saying something like:
; if a script is associated with a keystroke If IsScriptedKey()
Then ; run the script, as the script is only speaking a message
Else ; if it's not a script, it's a native app key Do nothing and
just announce the key EndIf

That seems to simplistic I know lol, but I would have thought this
was possible.  Specifying all script keys seems pretty
overkill....but I know things are never that straight forward
<grin. THX Steve.
-----Original Message-----
From: Udo Egner-Walter
Sent: Sunday, October 7, 2018 9:41 AM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Keyboard help

Hi Steve,

you don't need a hook necessarily. You can use TrapKey only for
getting control of the keys. For example:

<begin code>

; assign a shortcut to StartTrap to begin the trapping

Script StartTrap ()

TrapKeys (True, False)

EndScript

; end the trapping either by assigning a shortcut or by pressing
ESC (see ProcesskeyPressed)

Script EndTrap ()

TrapKeys (False)

EndScript


; here is the checking of the keys

Void Function ProcessKeyPressed (int iKeyCode, string sKeyName,
int IsBraille, int IsScriptKey)

; react on pressing F1

If sKeyName == "F1" then

SayString ("You pressed F1")

EndIf

; other keys ...


; End the trapping

If sKeyName == "ESCAPE" Then

PerformScript EndTrap ()

EndIf

; pass the function to other scripts

ProcessKeyPressed (iKeyCode, sKeyName, IsBraille, IsScriptKey)

EndFunction

<end code>


By the way if you need to process you own scripts, you can use the
hook too. For example:

<begin code>

; assign a shortcut to start trapping and the hook

Script StartHook ()

; Start hook function "MyHook"

AddHook (HK_SCRIPT, "MyHook")

; trap the keys

TrapKeys (True, False)

EndScript

; end the hook either by assigning a shortcut or by pressing ESC
(see
ProcessKeyPressed)

Script EndHook ()

; no more trapping

TrapKeys (False)

; remove the hook

RemoveHook (HK_SCRIPT, "MyHook")

EndScript


; in the hook function you can decide which script to run

void Function MyHook (string sScriptname)

; if the script name is "YourScriptName" then

if sScriptName == "YourScriptName" then

  ; allow execution

  return True

endIf


; if you want to end the hook you should allow EndHook to run

if sScriptName == "EndHook" then

  ; allow execution

  return True

endIf

; no execution for other scripts

Return False

EndFunction


; Check for key pressing

Void Function ProcessKeyPressed (int iKeyCode, string sKeyName,
int IsBraille, int IsScriptKey)

; If F1 is pressed


If sKeyName == "F1" then

; execute your script

PerformScript YourScriptName ()

EndIf

; If ESC is pressed

If sKeyName == "ESCAPE" Then

; unhook and don't trap keys

PerformScript EndHook ()

EndIf

; pass event to other scripts

ProcessKeyPressed (iKeyCode, sKeyName, IsBraille, IsScriptKey)

EndFunction

<end code>


But be careful: the hook is still running if you switch to other
application so it's a good idea of releasing it in the
AutoFinishEvent.

Hope this helps and good luck for your app

Udo



Am 06.10.2018 um 23:53 schrieb Steve Spamer:
Hi, thanks so much. I'll take a fresher look at this tomorrow, as
I feel I'm nearly there.  I've currently just copied across the
keyboard help, KeyboardHelpHook and UnhookKeybaordHelp to my
scripts.  I can add my own scripts to speak in the Keyboard
HelpHook function, but stopping non scripted keys are still
getting through.  I'm missing something, but hopefully I'll see
it with a refreshed brain :).  Thanks again.
Steve.

-----Original Message-----
From: Udo Egner-Walter
Sent: Saturday, October 6, 2018 7:07 PM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Keyboard help

Hi Steve,

I'm not sure if I understand you.

If you install a hook in your application, for example

AddHook (HK_SCRIPT, "MyHook")

then inside the hook function "MyHook" you can allow a script to
be executed or not. All scripts had to pass the function and you
alone decide which scripts to execute.

If you further trap the keys with the TrapKeys function then the
keys were not sent to the application.

In the KeyPressedEvent of you application (or the like) the keys
are still arriving. So here you can decide what to do (for
example start your own script, end the hook and so on).

But please remember to uninstall the hook at the end. Otherwise
the default scripts are not running any more.

Hope this helps a little

Udo



Am 06.10.2018 um 19:36 schrieb Steve Spamer:
Hi, a question on Jaws keyboard help.

I currently have a working solution that allows a user to turn
on keyboard help and get descriptions of specific keys in any
particular window.
All
of
this information is in a set of scripts that you switch to when
pressing jaws key plus 1.  It maybe not the most elegant
solution, as it still allows any undocumented keys to be
processed by the application.

So, looking at the Jaws help, I'm wondering if anyone knows if
the default script could be modified to access the assigned keys
I have, while ignoring any other key, so not letting it be
processed.  The lines of interest in the default jaws cripts are
I think:

AddHook (HK_SCRIPT, "KeyboardHelpHook") ; ignore any keys not
attached to scripts
TrapKeys(TRUE)
CaptureAllGestures(TRUE)

The line:
AddHook (HK_SCRIPT, "KeyboardHelpHook") looks to me as if this
"KeyboardHelpHook" is where the information is taken from.  Of
course I am probably totally wrong, but if I could find this, it
may give me clues to what to do.  Otherwise, is there a way to
use this default script, but use information/keys I have in a
set of scripts/ jkm files etc.

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

__________�

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

__________�

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

__________�

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

__________�

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


__________

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

__________

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


__________

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

__________

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


__________

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

__________

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



__________

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

__________

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



__________

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

__________

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


__________�

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

__________�

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

Other related posts: