Skip to content

Ask ​

Purpose: ask the operator during a run, either to judge PASS/FAIL or to enter a number or some text that is stored in a variable.

Ask settings

Answer picks the kind of answer (PASS / FAIL, Number, Text), and Save as is the variable that holds the answer (required for Number and Text).

JSON ​

json
{ "ask": { "message": "Is the LED on?", "answer": "pass_fail" } }
{ "ask": { "message": "Measured voltage (V)", "answer": "number", "var": "volt" } }
{ "ask": { "message": "Serial number", "answer": "text", "var": "sn" } }
FieldRequiredMeaning
messageYesThe question, 1–127 characters. Can include ${variable}
answerNopass_fail (default), number or text
varRequired for number/textVariable that holds the answer

While running ​

The dialog for each kind of answer:

Ask: PASS/FAIL

Ask: enter a number

Ask: enter text

Stop run stops this run, and the Ask step counts as not run.

Result ​

AnswerPASSFAIL
pass_failThe operator clicks PASSThe operator clicks FAIL
numberA number is entered (such as 3.3 or 0x10) and stored as a numeric variableWhat was entered is not a number
textStored as a text variable—

Example ​

Asks in turn whether the LED is on, the measured voltage and the serial number, then the Log prints Serial SN-0001, 3.3 V.

Ask example result

Notes ​

  • Text variables can only be used in Log, Pause and Ask messages (${sn}), not in calculations. Each round holds up to 32 text variables, each up to 95 characters.
  • When run from the command line with --run-script there is no operator, so Ask is judged FAIL (no operator to answer).

Download the sample script ​

Sample script

Before running it, start a Slave window on 127.0.0.1:502 and click Listen, then open the script with Open JSON in Script mode and click Run. See How to use the examples.

Roach Modbus Tool by Mr.Roach