You can use HTML formatting inside a string in URScript, for example if you create a popup using the following command:
popup("<html>Width: 20 inches<br>Height:10 inches<br>Would you like to continue with these settings?</html>")
This will for mat the text as you wish, with the <br> tag indicating a new line. You can also use other html tags to aid formatting too, enabling you to centre text, use bold or italic text etc.
As for a yes/no popup, the only popups available URScript are those shown in the popup() command I used to demonstrate this. You will have to code your own if you want some yes/no functionality
Hope this helps.
EDIT: For anyone wondering this also works in java and thus can be used when configuring JLabels and other swing components for a URCap
Thank you!! Formatting the string with html solved my needs.
As for a yes/no popup, the only popups available URScript are those shown in the popup() command I used to demonstrate this. You will have to code your own if you want some yes/no functionality
Actually this is not true. The popup() is the only command published in the script manual, but there are additional commands to do the float, integer, string, or boolean options that are not published. If you create these operator inputs with polyscope and run the program, you can view the compiled program script. If you hook up a keyboard, CTRL+ALT+F1 (or CTRL+ALT+F7 for simulator) (u: root, p: easybot), cd to /programs or where you saved your files, you can run the following command to view the compiled script:
nano filename.script
So…
my_variable = request_boolean_from_primary_client(“Width: 20 inches Height: 10 inches Would you like to continue with these settings?<\html>”)
… produces this:
the other commands are:
returnVar = request_float_from_primary_client(“description string”)
returnVar = request_integer_from_primary_client(“description string”)
returnVar = request_string_from_primary_client(“description string”)
This is extremely helpful information! We should ask to put this is the manual. I can see myself need this in the future and not finding this specific post…
The trick here is to use a URScript function called to_str which allows you to turn a number into a string to allow it to be used in a popup. I have written a little example that can below:
global var = 12
global var_two = 47
popup("<html>look, a variable! "+to_str(var)+"<br>look, another! "+to_str(var_two)+"<html>")
Following the work explained before, I would like to ask you about the following information:
I have 1221 script files to mill different tiles that have to be done individually. It is possible to set up a path by which to have a popup command on which to be able to write the specific number and launch the .script file, or simply select continue?
I hope I have explained correctly(Coding is not my strong suit)
I will be very grateful if you can give me some idea what can be the best way to do it
I raised this issue internally in the past. It have not been resolved yet and I might fear that it will not be addressed. I will forward the request for PolyScope X. Hopefully we can make it happen there🤞
I was doing QC on the function and inadvertently learned how to generate None in URScript. It also lists out the valid types to feed into those functions: