I need to use the serial number in my program to stop it if the number is incorrect.
How can I read the robot serial number to use it in the program?
I don’t think you can do this purely in URScript. The URCAP API has methods such as getSerialNumber() or you can use a generic file read command, since the controller contains a txt file with the robot’s serial number in it. But again, both of these are achieved via Java through a URCAP.
You’d likely be able to implement the file read method if you wrote a daemon to do so.
You can also check out the dashboard server, as it has a getSerialNumber() method as well:
That’s probably the easiest way to go.