Skip to main content

WearML Scripting API

WearML directives

When writing a WearML script to modify a compiled application there are many options available. All the available configurable options can be edited to provide a completely customized experience to an application’s users.

Top level elements

WearML scripts begin with a couple of elements which provide information about the package and script to WearHF.

ElementDescriptionRequired
PackageUsed to identify the package that the WearML script belongs toYes
UniqueIdentifierAt least one UniqueIdentifier attribute must be specified to identify a component (View) that is unique for that screen across the whole package.Yes
LanguageThe language code for the modifications included in the fileNo

UniqueIdentifier attributes

At least one of these attributes must be specified to identify a component (View) that is unique for that screen across the whole package.

AttributeDescription
idA unique ID attribute for an on screen component that is not used on any other screen.
textA unique text attribute for an on screen component that is not used on any other screen.
content_descriptionA unique content_description attribute for an on screen component that is not used on any other screen.
typeA unique type attribute for an on screen component that is not used on any other screen.
View elements attributes

View elements attributes

The remainder of the WearML Script is made up of the screen’s views, listed in a hierarchy. Each view can contain the following attributes which instruct WearHF on how to interpret them.

Attributes

At least one of these attributes MUST be specified to identify the component (View).

AttributeData TypeDescription
idStringA unique ID attribute to identify the component that is not used on any other component.
textStringA text attribute to identify the component that is not used on any other component.
content_descriptionStringA unique content_description attribute to identify the component that is not used on any other component.
rectRect (left, top, right, bottom)The exact coordinates for the view.

Each of the following attributes are optional and will change the default behavior of a view. All views in a script can contain any number of the following attributes.

AttributeData TypeDescription
rootboolean (yes/no)Can only be applied to the top most View element. The root’s attributes are applied to all of its children unless they have their own attributes defined.
xyPoint (x,y)The screen co-ordinates that the overlay will be displayed.
speech_commandStringDefines the source to use for the speech command for the component. See available options.
overlay_show_numberboolean (yes/no)Turns the numeric indexing overlays on or off. (default: yes)
overlay_show_textboolean (yes/no)Turns the text overlay on or off. (default: no)
overlay_persistsboolean (yes/no)Sets if the numeric index and/or text overlay will always be shown. (default = no)
overlay_orientationStringSpecifies the orientation of the text overlay relative to the numeric index overlay. See available options.
overlay_background_colorStringSpecifies background color (Hex with #) of the overlay.
overlay_text_colorStringSpecifies text color (Hex with #) for the overlay.
overlay_border_colorStringSpecifies border color (Hex with #) for the overlay.
overlay_anchorPoint (x,y)Sets the anchor point horizontally and vertically. Each value is specified as a percentage. 0 anchors to top/left edge of the element and 100 anchors to bottom/right edge of the element.
overlay_offsetPoint (x,y)Sets the offset horizontally and vertically for where the overlay will be displayed.
overlay_show_dotboolean (yes/no)Specifies that an overlay dot should be displayed to indicate a voice command. (default: no)
overlay_show_iconboolean (yes/no)Specifies that an microphone overlay icon should be displayed next to the text overlay to indicate a voice command.. (default: no)
scrollStringSpecifies that head-tracked scrolling should be turned on the the view, and the scrolling activity should be directed at the UI element. See available options.

| text_field | String | Characterizes a text-field to tell WearHF what form of data entry should be used. See available options. | | barcode | String | Will define which type of barcode is being scanned. Ignored if the text_field isn’t set to barcode. (default: any) See available options. | | global_commands | boolean (yes/no) | Sets whether global commands should be enabled (‘show help, navigate back, navigate home’, etc…). | | broadcast_results | boolean (yes/no) | Tells WearHF to broadcast ASR results via a SPEECH_EVENT. See Development Example – Speech Recognizer for more details. | | make_clickable | boolean (yes/no) | Force the view to be clicked with a mouse click when the speech command is spoken. |

speech_command Options

If speech_command is left blank the voice command will be disabled for the component.

OptionDescription
textUse the string in the text attribute for the speech command.
content_descriptionUse the string in the content_description attribute for the speech command.

Any other value will set the voice command to the entered value.

overlay_orientation Options

OptionDescription
topDisplay text overlay on top of the numeric index overlay.
rightDisplay text overlay to the right of the numeric index overlay.
bottomDisplay text overlay underneath the numeric index overlay.
leftDisplay text overlay to the left of the numeric index overlay.

scroll Options

OptionDescription
noneDisables headtracking.
horizontalHeadtracker only works horizontally.
verticalHeadtracker only works vertically.

text_field Options

OptionDescription
keyboardOpens a virtual keyboard allowing the user to enter some text by selecting characters.
dictationOpens a dictation keyboard allowing the user to enter some text by freely speaking text in sentences.
barcodeOpens a barcode scanner allowing the user to enter some text by scanning a barcode.

barcode Options

OptionDescription
anyAllow the barcode scanner to scan any supported barcode types.
qrLimit the barcode scanner to only scan QR type barcodes.
code128Limit the barcode scanner to only scan Code 128 symbology barcodes.
upcLimit the barcode scanner to only scan Universal Product Code symbology barcodes.
eanLimit the barcode scanner to only scan EAN symbology barcodes.