Domain-specific Scripts for Web Pages with JAWS

NOTE: For those of you participating in the live Webinar, the following link will open the documentation in a new browser window.

Introduction

As of JAWS 17 and later, the Freedom Scientific Scripting language supports scripting specifically for a Web App in a browser. When referring to a browser, it is always assumed that browser is supported by Freedom Scientific screen readers.

Hence, a scripter may create domain-specific scripts for a web page or web application. When a specific domain is viewed in a supported browser, the domain-specific scripts are loaded in addition to the host application scripts. Thus, the behavior in the domain-specific app supersedes application behaviors.

The ability to customize a Web app through the Freedom Scientific Scripting language allows you to:

Definitions

Editing the confignames.ini file

You must enable your custom scripts to load within any of the supported browsers by adding a section and certain lines to Confignames.ini. For example, let's assume that your custom scripts are the sample provided by Freedom Scientific for the Sharepoint Web app from Microsoft. For this and any other custom scripts to run within your browser, you must create the file in your User\Settings(language-specific) folder with the section called [Domains]. The entries in this section must be in the form: specific Web address = (equals sign) followed by the name of your custom script set. So in this example, your Confignames.ini file would show this:

[Domains]
fsservices-my.sharepoint.com=SharePointWeb

New functions in JAWS 17

As of JAWS 17 and later, the new functions you can use to customize your Web Aps include:

Special Note:

In order to pass the FSID parameter to the function, PerformActionOnElementWithId, the FSID must be obtained for the current session of the page. It is a dynamically changing value much like a window handle that changes each time the Web page loads. therefore, you will need to write a function such that the GetDocumentXML function retrieves the desired FSId just before you pass it to PerformActionOnElementWithId. Clearly, it is less favorable to use this function rather than PerformActionOnElementWithTagAndAttribute. but both functions can be very useful. See the sample script set for Sharepoint that ships with JAWS for an example.

The GetDocumentXML function

The GetDocumentXML function returns XML for the current virtual document. It obtains well-formed XML from the Dom Server for parsing using the MSXML com object.

From the page where you wish to create a custom script, start by using the function, GetDocumentXML, to determine what content you can utilize to pass parameters to the function, PerformActionOnElementWithTagAndAttribute. You can return the string from this function into the USERBuffer or copy it to the clipboard, etc. the idea is to save the content this function returns in a file that you can examine at your leeisure.

PerformActionOnElementWithTagAndAttribute

The PerformActionOnElementWithTagAndAttribute function allows a script to locate an element from the FS DOM structure and perform an action on it such as set focus or left mouse click. The first parameter is a constant found in HJConst.jsh which specifies the action that will be performed once the element is located. The second parameter is the FSTag of the element to locate. The third and forth parameters are a pair consisting of an attribute and its value. For example, the third parameter might be "ID" and the forth parameter "NextButton." This attribute and value must come directly from the output of the GetDocumentXML function.

The PerformActionOnElementWithTagAndAttribute function returns either true or false depending on if the element was located and the action performed. The following code example demonstrates using the function to locate and activate the "Next" link on a Google search page.

If PerformActionOnElementWithTagAndAttribute (action_DoDefaultAction, "A", "id", "pnnext") Then
Say ("Next page", OT_Message)
Else
Say ("Could not find the Next link", OT_Message)
EndIf

The following constants are found in HJConst.jsh

Action_setFocus=0,
Action_makeVisible=1,
Action_doDefaultAction=2,
Action_leftMouseClick=3,
Action_rightMouseClick=4,

Domain-Specific Utilities

As of JAWS 17 and later, several of the Freedom Scientific utilities allow for customizing by domain Web-based applications, even those not specifically within a browser. the utilities supported for this type of customization include:

Utilities such as the Frame Viewer and Graphics Labeler are not customizable for specific domains and will continue to behave as always. If you do nothing to customize domain-specific settings, JAWS will continue to behave as always by default as well as for all supported applications.

Domain Option in the Files menu of the Utilities

The Script, Keyboard, and Dictionary managers will henceforth have a menu item added to their respective File Menus to open or create domain-specific files.

When the active application is Web-based, the Dictionary Manager will have a new menu item added to the File Menu that allows you to open the domain dictionary file. This action will create the dictionary as needed and open it for you to customize just for that domain.

The FSDN

The FSDN (Freedom Scientific Developers Network) is the best resource for getting documentation on various functions and scripts. Please visit the following page to download the current version:

JAWS documentation page

Prior page

Next page