Sending modbus URScripts with the robot in stop mode

Hi Guys,

I need to be able to create and write a modbus signal after tapping a button. I want to do this before running the program. My UR10e is communicating with a festo controller which will move a 7th axis rail. Before starting the program, the user need to be able to move the robot through the 7th axis, that’s why I need to send modbus register outputs after tapping a button (Jog the robot through the 7th axis).

I have been using an example published by @jbm about script communicator, but I’m not sure where should I insert the urscript command : modbus_set_output_register(“dModeSelector”, 3, False).

sec Command2():
var_2 = 30 + 40
modbus_add_signal(“192.168.4.20”, 255, 4, 3, “dModeSelector”, False)
modbus_set_signal_update_frequency(“dModeSelector”, 10)
socket_open(“127.0.0.1”,5500,“EXPORT_SOCKET”)
socket_send_string(var_2,“EXPORT_SOCKET”)
socket_send_byte(13,“EXPORT_SOCKET”)
socket_send_byte(10,“EXPORT_SOCKET”)
socket_close(“EXPORT_SOCKET”)
end

Integer result is: 70