Universal Robots Forum

Display variable inside operator input assignment popup

I’d like to display the current value of an installation variable in the message to the operator in a yes/no assignment command popup. The operator would verify whether the number is correct, and if it is not correct, they would enter the right one.
Something like the following:

JobYorN = “Is the current job number [inst var] ?”
[yes] [no]

if JobYorN = no

    [inst var] = "Please enter the job number." 
                                  string: _________



this can be achieved in a Swing URCap with using a OptionDialog. See here To get your installation variable you can call your installationNode from your contribution with apiProvider.getProgramAPI().getInstallationNode

thank you for the tip. Since I’ve never made my own URCap before, I’ve just downloaded and installed the URCaps Starter Package, installed it on my VM, and gone through all the tutorials. Now I’m trying to decide the best way to proceed. Do I have to make a new program node from scratch, or could I modify the existing Assignment command to allow installation variables to be shown along with text? If I can modify the existing command, where do I find its code? Sorry if these are basic questions, I am new to this.

Hello @anna,

You can’t modify any existing nodes in polyscope such as Assignment, but you should be able to create your own and use the HelloWorld swing example in the starter package to give you an idea of using variables in your popups. The generateScript() method in the ProgramNodeContribution shows how this would be done through scripting.

If you are trying to make your own URCap this would be a great place to start, if you simply want to use this functionality in your current program, you can still implement the script portion in your program manually. Hope this helps.

Hi! This is my first time develloping a URCap. I need to make a Dialog like the one who @m.birkholz suggested. I’ve been readding a lot and following the tutorials on URCaps GettingStarted. I’ve succesfully developed a URCap like the LightsUp one of the video but featuring ComboBox.

But now i need to open a DialogBox every time the program start, for allow the operator to select a item from a combox.

My questions,

  1. Where should I put this dialogBox? Should I use a eventlistener to display it at a program start?
  2. From the example of DialogBox:

final JOptionPane optionPane = new JOptionPane(
“The only way to close this dialog is by\n”
+ “pressing one of the following buttons.\n”
+ “Do you understand?”,

Should i create a JOpetionPane inside of BuildUI?

Maybe I’m little confused right now, but I’ve several years of programming Industrial Robots, PLC and Pyhton, but just a few codes in Java.

Any help or guide will be most welcome.