Skip to main content
Skip table of contents

tp_get_user_input(message, input_type)

Features

This function receives the user input data through the Teach Pendant.

Parameters

Parameter NameData TypeDefault ValueDescription

message

string

-

Character string message to be displayed on the TP user input window

  • Messages are limited to within 256 bytes.
  • It is recommended that the text be concise. For long text, some content is omitted with an ellipsis (…).
  • Formatting-related code such as newline (\n) or carriage return (\r) is not allowed.

input_type

int

-

TP user input message type

  • DR_VAR_INT: Integer type
  • DR_VAR_FLOAT: Real number type
  • DR_VAR_STR: Character string
  • DR_VAR_BOOL: Boolean

Return

ValueDescription

User input data

User input data received from the TP

Exception

ExceptionDescription

DR_Error (DR_ERROR_TYPE)

Parameter data type error occurred

DR_Error (DR_ERROR_VALUE)

Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME)

C extension module error occurred

DR_Error (DR_ERROR_STOP)

Program terminated forcefully

Example

PY
q1 = posj(10, 10, 10, 10, 10, 10)
q2 = posj(20, 20, 20, 20, 20, 20)
q3 = posj(30, 30, 30, 30, 30, 30)
q4 = posj(40, 40, 40, 40, 40, 40)
q5 = posj(50, 50, 50, 50, 50, 50)
q6 = posj(60, 60, 60, 60, 60, 60)

int_y= tp_get_user_input("message1", input_type= DR_VAR_INT)
if int_y==1:	# Moves to q1 if the TP user input is 1.  
  movej(q1, vel=30, acc=30)
else:		# Moves to q2 if the TP user input is not 1.
  movej(q2, vel=30, acc=30)
  
float_y= tp_get_user_input("message2", input_type= DR_VAR_FLOAT)
if float_y==3.14:	# Moves to q3 if the TP user input is 3.14.
  movej(q3, vel=30, acc=30)
else:			# Moves to q4 if the TP user input is not 3.14.
  movej(q4, vel=30, acc=30)

str_y= tp_get_user_input("message3", input_type= DR_VAR_STR)
if str_y=="a":		# Moves to q5 if the TP user input is "a". 
  movej(q5, vel=30, acc=30)
else:			# Moves to q6 if the TP user input is not "a".
  movej(q6, vel=30, acc=30)

bool_y= tp_get_user_input("message3", input_type= DR_VAR_BOOL)
if bool_y==True:        # Moves to q5 if the TP user input is "True or 1". 
  movej(q5, vel=30, acc=30)
else:                   # Moves to q6 if the TP user input is "False or 0"
  movej(q6, vel=30, acc=30)
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.