6.8 Chapter Exercises
These exercises give you some practice in creating scripts that read pieces
of information.
Exercise 6.1: Reading the Script Manager Status Line
The objective of this exercise is to use built-in cursor movement and
reading functions to read the status line in the Script Manager.
- Press INSERT+F2 to activate the Run JAWS Managers dialog.
- Press S to select the Script Manager followed by ENTER.
- Since this script should work in Script Manager, you need to open the script file for
the manager. Choose Open Shared File from the File menu or press ALT+F followed by the letter E.
- Type the file name Script Manager and press ENTER. You don’t need to include
the file extension for script source files, .jss, because this is the
default file type.
- Press CTRL+END
to move the insertion point to the bottom of the file. Press ENTER
to create a blank line between the last script and your new script.
- Press CTRL+E to activate the New Script dialog.
- Type ReadBottomLine in the Script Name edit box. Be sure to
capitalize the first letter of each word in the name of the script.
- Press TAB to move to the Can be Attached to Key check box. Press SPACEBAR to
check the check box.
- Press TAB to move to the Synopsis edit box. Type "Reads the status line in the Script Manager" without the quotation marks.
- Press TAB to move to the Description edit box. Type "Reads the status line in
Script Manager using various cursor movement and reading functions"
without the quotation marks.
- Press TAB to move to the Category edit combo box. You do not need to enter any
information in this combo box as it is not used.
- Press TAB to the Assign to Key edit box. Press CTRL+SHIFT+L. This is the
keystroke that activates the script.
- Press ENTER to close the New Script dialog and return to the Script Manager window.
- Press UP ARROW once to move to the first blank line of the ReadBottomLine script.
- Press CTRL+I to activate the Insert Function dialog. You are looking for the function
to save the current cursor. Type Save in the Function Name edit
box. Did JAWS find the SaveCursor function? If so, then press ENTER
to insert the function into your script and close the Insert Function dialog.
- After you have inserted the SaveCursor function into your script, the insertion
point is at the end of the line. Press ENTER to move to the next line.
- Press CTRL+Ito activate the Insert Function dialog. You now need to locate the
InvisibleCursor function. This will activate the Invisible cursor which you will use to read the status line of the window. Find the InvisibleCursor function and press ENTER to insert it.
- Press ENTER to complete the line and move to a new blank line.
- Follow the same procedure found in step 17 to insert the following functions into your script:
- RouteInvisibleToPC
- JAWSPageDown
- SayLine
After following these steps, the script should
look like the following:
Script ReadBottomLine ()
SaveCursor ()
InvisibleCursor ()
SaveCursor ()
RouteInvisibleToPC ()
JAWSPageDown ()
SayLine ()
EndScript
- If your script looks like the one above, press CTRL+S to save and compile
the script file. Did you hear the compile complete message? If so, then
you are ready to test the new script. If not, then go back to the script
and make sure it looks like the one above then compile your script file a
second time.
- Press CTRL+SHIFT+L to test your script. Did you
hear the status line of the Script Manager spoken by JAWS?
Exercise 6.2: Read the Line Number and Total Lines in the Script Manager Status Line
The objective of this exercise is to create a script that reads only the
line number and total number of lines within the status line. In the previous
exercise, you created a script that read the entire Script Manager status line. Create a script that only speaks the line
number and total number of lines in the script file. On the script manager
status line there is more information than you necessarily want to hear, for
example, "For help, F1". Your script should only say what you
want to hear, which is the word "line" followed by
the total number of actual lines in the script file.
If the Script Manager is not the active application, press ALT+TAB
until the Script Manager becomes the active window. The Script Manager.jss
script file should also be opened within the manager. You can verify the file
name by reading the title of the window with INSERT+T. Before you create
the script, follow the steps below to determine what functions are needed:
- Press NUM PAD MINUS twice in succession to activate the Invisible cursor.
- Press INSERT+NUM PAD MINUS to route the Invisible cursor to the PC cursor location.
- Press PAGE DOWN to move the Invisible cursor to the bottom of the window.
- Press HOME to make sure the Invisible cursor is at the beginning of the status line.
- Press INSERT+RIGHT ARROW until JAWS speaks "Line:".
- Press INSERT+PAGE UP to read from the location of the Invisible cursor to the end of the
line.
After you followed the steps above, did JAWS speak the line number and total
number of lines? Your new script should also read only the line number and
total number of lines within the current script file. The steps needed to
create the script follow:
- Press CTRL+END to move to the bottom of the script file.
- Press ENTER twice to insert a blank line between the last script and your new script.
- Press CTRL+E to activate the New Script dialog.
- Fill in the script information fields as follows:
- Script Name: ReadLineNumber
- Can be Attached to Key: checked
- Synopsis: Reads the line number and total number of lines.
- Description: Reads the line number and total number of lines from the status line.
- Category: not used
- Assign To: CTRL+SHIFT+S
- After you have entered all the script information, press ENTER to close the
New Script dialog and return to the Script Manager edit area.
- Press UP ARROW once to move to the first blank line in the body of the script.
- Use the Insert Function dialog, activated by CTRL+I, to insert the
following functions into your script:
- SaveCursor ()
- InvisibleCursor ()
- SaveCursor ()
- RouteInvisibleToPC ()
- JAWSPageDown ()
- JAWSHome ()
- NextWord ()
- NextWord ()
- NextWord ()
- NextWord ()
- NextWord ()
- SayFromCursor ()
Note: If you need to review
how to select a function from the Insert Function dialog, see 5.5 Inserting Functions for more
information. You should press ENTER after each function is inserted into
your script. Failure to do so, causes each of the
functions to be inserted on the same line.
- After you have followed all the steps above, your script should look like the
following:
Script ReadLineNumber ()
SaveCursor ()
InvisibleCursor ()
SaveCursor ()
RouteInvisibleToPC ()
JAWSPageDown ()
JAWSHome ()
NextWord ()
NextWord ()
NextWord ()
NextWord ()
NextWord ()
SayFromCursor ()
EndScript
After you have completed the steps above, Compare your script to the script shown above. Make any
corrections to your script as necessary.
Note: When correcting your
script, you can use normal editing techniques just as you would in a word
processor or text editor.
- Now that you have reviewed your script, press CTRL+S to save and compile
your script. Did you hear the compile complete message? If so, then you
are ready to test your script. If not, then note the error shown in the
Error dialog. Next, press ESCAPE to close the Error dialog and
return to your script. Review your script for the error and correct it.
You can refer back to the script shown above, if necessary.
- Once you have a complete compile, press CTRL+SHIFT+S to activate your
script. Did you only hear the line number and total number of lines spoken
by JAWS?