UI
Talk to the person at the browser and change what they see: show popup notices and messages, ask questions and wait for the answer, bring a robot skill or a workspace to the front, and show and navigate Custom UI screens.
Where to find it: type UI. in a JavaScript script, or open the ARCx API view of the script editor and expand UI
Commands
| Command | What it does |
|---|---|
| UI.customUIBack | Go back to the previous custom UI screen in the breadcrumb. |
| UI.customUIHome | Go to the home custom UI screen and clear the breadcrumb. |
| UI.getCustomUIScreen | The title of the custom UI screen showing now, or an empty string when there are none. |
| UI.getCustomUIScreens | The titles of every custom UI screen in the project. |
| UI.isWebClientConnected | Whether any web browser is connected to ARCx right now, so popups and prompts have somewhere to appear. |
| UI.navigateTo | Sends every connected web browser to a page and carries on without waiting. |
| UI.promptForAnyNumber | Ask the user to type any number, and wait for the answer. |
| UI.promptForChoices | Ask the user to pick one of a list of choices, and wait for the answer. |
| UI.promptForNumberRange | Ask the user to pick a number between start and end, counting by increment. |
| UI.promptForUserInput | Ask the user to type something, and wait for the answer. |
| UI.showControl | Opens a robot skill's window on every connected web browser. |
| UI.showCustomUI | Show the custom UI screen with this title, adding it to the breadcrumb, and bring every browser that is not already on a custom UI page to the viewer. |
| UI.showDesktop | Switches every connected web browser to a workspace desktop. |
| UI.showDialogMessage | Shows a message box with an OK button on every connected web browser and waits until someone clicks it or the script is stopped. |
| UI.showPopupMessage | Shows a short information notice in the corner of every connected web browser and carries on without waiting. |
| UI.showTextInputPrompt | Asks for a line of text on every connected web browser and waits for the first answer or for the script to be stopped. |
Details
UI.customUIBack
Go back to the previous custom UI screen in the breadcrumb.
UI.customUIBack()
UI.customUIHome
Go to the home custom UI screen and clear the breadcrumb.
UI.customUIHome()
UI.getCustomUIScreen
The title of the custom UI screen showing now, or an empty string when there are none.
UI.getCustomUIScreen()
Gives back: string. The current screen's title, or an empty string.
UI.getCustomUIScreens
The titles of every custom UI screen in the project.
UI.getCustomUIScreens()
Gives back: string[]. A list of screen titles, empty when the project has none.
UI.isWebClientConnected
Whether any web browser is connected to ARCx right now, so popups and prompts have somewhere to appear.
UI.isWebClientConnected()
Gives back: boolean. Whether at least one web browser is connected.
UI.navigateTo
Sends every connected web browser to a page and carries on without waiting.
UI.navigateTo(url)
| Value | Type | What it is |
|---|---|---|
url |
string | The page address, usually an ARCx page path such as /Project/Workspace/Desktop/0. |
UI.promptForAnyNumber
Ask the user to type any number, and wait for the answer.
UI.promptForAnyNumber(textPrompt)
| Value | Type | What it is |
|---|---|---|
textPrompt |
string | The question to show. |
Gives back: number. The number typed, or 0 if it was not a number, was cancelled or no browser was connected.
UI.promptForChoices
Ask the user to pick one of a list of choices, and wait for the answer. Uses the wait-for-speech popup because it renders every choice as a button, so the user can click one - and, if the project has a speech to text robot skill, say one instead. With no speech skill installed it logs a warning and the buttons still work, so this does not depend on speech being set up.
UI.promptForChoices(textPrompt, choices)
| Value | Type | What it is |
|---|---|---|
textPrompt |
string | The question to show. |
choices |
string[] | The choices to offer, at least one. |
Gives back: string. The choice picked, "timeout" after 60 seconds with no answer, "canceled" if cancelled or no browser was connected, or an empty string if speech recognition failed.
UI.promptForNumberRange
Ask the user to pick a number between start and end, counting by increment.
UI.promptForNumberRange(textPrompt, start, end, increment)
| Value | Type | What it is |
|---|---|---|
textPrompt |
string | The question to show. |
start |
number | The first number offered. |
end |
number | The last number offered. It may be below start to count down. |
increment |
number | The step between numbers. Must not be 0, and at most 100 numbers are allowed. |
Gives back: number. The number picked, or start if there was no answer within 60 seconds, it was cancelled or no browser was connected.
UI.promptForUserInput
Ask the user to type something, and wait for the answer.
UI.promptForUserInput(textPrompt)
| Value | Type | What it is |
|---|---|---|
textPrompt |
string | The question to show. |
Gives back: string. The text typed, or an empty string if cancelled or no browser was connected.
UI.showControl
Opens a robot skill's window on every connected web browser. Fails with an error if no robot skill has that title.
UI.showControl(windowTitle)
| Value | Type | What it is |
|---|---|---|
windowTitle |
string | The robot skill's window title, not case sensitive. |
UI.showCustomUI
Show the custom UI screen with this title, adding it to the breadcrumb, and bring every browser that is not already on a custom UI page to the viewer.
UI.showCustomUI(screenTitle)
| Value | Type | What it is |
|---|---|---|
screenTitle |
string | The title of the custom UI screen to show. |
UI.showDesktop
Switches every connected web browser to a workspace desktop.
UI.showDesktop(desktopNum)
| Value | Type | What it is |
|---|---|---|
desktopNum |
number | Which desktop to show, 0 being the first one. |
UI.showDialogMessage
Shows a message box with an OK button on every connected web browser and waits until someone clicks it or the script is stopped.
UI.showDialogMessage(title, message)
UI.showDialogMessage(title, message, okButtonText)
UI.showDialogMessage(title, message, okButtonText, cancelButtonText)
| Value | Type | What it is |
|---|---|---|
title |
string | The title of the message box. |
message |
string | The message to show. |
okButtonText |
string | Optional. The text on the button. |
cancelButtonText |
string | Optional. The text on the Cancel button. Leave it empty to show no Cancel button. |
Gives back: boolean. Whether OK was clicked, which is never the case when no browser was connected.
UI.showPopupMessage
Shows a short information notice in the corner of every connected web browser and carries on without waiting. Long messages are cut to about 120 characters. Nothing shows if no browser is connected.
UI.showPopupMessage(message)
UI.showPopupMessage(message, severity)
| Value | Type | What it is |
|---|---|---|
message |
string | The text to show. |
severity |
number | Optional. 0 normal, 1 info, 2 success, 3 warning, 4 error. |
UI.showTextInputPrompt
Asks for a line of text on every connected web browser and waits for the first answer or for the script to be stopped.
UI.showTextInputPrompt(title)
UI.showTextInputPrompt(title, description)
UI.showTextInputPrompt(title, description, defaultValue)
| Value | Type | What it is |
|---|---|---|
title |
string | The title of the prompt. |
description |
string | Optional. Text explaining what to type. |
defaultValue |
string | Optional. The answer filled in to start with. |
Gives back: string. The text typed, or an empty string if cancelled or no browser was connected.