Universal Robots Forum

Export variables into a file

Dear Experts,

Is it possible for URScript* to export/write all variables or specifics variables, or a list, into a file (.txt for example into /programs folder or specific path, usbdisk, etc.)?

Knowing that;

  • Do not use the “.variables” file
  • I try Python json/dump, file.write(mylist), file.writelines, etc. code without sucess
  • UR3/CB3/Polyscope/URScript

You have to either send the variables (e.g. over socket or XML-RPC) to a daemon, that can log the relevant variables to a file.
Alternatively, have a daemon read the variables automatically, coming from the primary client interface.

URScript does not natively support file system operations.

I’ll leave the demon in his cave for now …
It’s a shame that URScript does not handle files natively, it would have been useful to be able to export variables as results. Thank you for this unequivocal answer.

1 Like

Please explain:

“Alternatively, have a daemon read the variables automatically, coming from the primary client interface”

Thanks,
Mark

Check out the documentation to the Primary Client interface in the Excel sheet.

Under the section 3.2 tab (hasn’t changed since) there is the messages GlobalVariablesSetupMessage and GlobalVariablesUpdateMessage.
These stream the values of (global) variables, as also shown in the Variables tab.

Hi, you may try this free urcaps mentioned in Writing and reading a text file