When to call own Functions

For my Bachelor Project I am coding Costum Popups for my Company. They work (The Popups show up), but the Problem I have is, that the Popups are not generated when the ProgrammNode is called. When i start the Programm, the Popup is generated and not when the ProgramNode is called.

Right now i am calling my generatePopup() Function inside the generateScript() Method.

A little bit of Info, i am using a JPanel for the Popup and the user can set properties like the color, size etc.in the Programmnode.
The user sets the Properties while the code isnt Running in a normal ProgramNodeView.
My question now is, how do I achieve that my“Popup” generates when the ProgramNode is called and not when the whole Program is started?

Thank you!

Hi @linus.etemi,

The purpose for the Java method generateScript(), is to contribute to the construction of the URScript the URController is going to execute. You can find more info on the topic here:
https://plus.universal-robots.com/urcap-basics/ur-software-architecture/
The simple solution is that your Program in the scriptWriter add a line where you call the script function popup(s, title=’Popup’, warning=False, error=False, blocking=False)
the string s can contain a limited subset of html to format the popup.

If you want to construct a Swing popup then you task will be to have a server running on the Java side and the script generated shall then send a message(plain socket or XML rpc) to inform the Java side that it is time to display the popup.

I hope it gives you a clue for the direction!

Thanks! I have constructed the Swing Popups already, just needed to know how to properly call them. I Will try to do that with a simple Socket Server!

In the past I’ve used an XMLRPC server to allow URScript to call java functions, with the java side XMLRPC server implementation inspired by the following sample:

I have then opened a connection to that server in URScript and used that to call java methods in real time when required.

Hope this helps.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.