Universal Robots Forum

Assingment in Script HTML code Lenght

Iam trying to make an Assinment with a long text

ok

when i want some of the text to be bold. it cuts some of the text off.
nogo

it like there is a max value of signs that is allowed.
is there any way to make the value longer.?

Script code

def Popup():
Palleplads1 = PalleINTtoString(O_Palle_1,"O_Palle_1")
Palleplads2 = PalleINTtoString(O_Palle_2,"O_Palle_2")
Plads1STA = PalleStaToString(O_Palle_sta_1,"O_Palle_sta_1")
Plads2STA = PalleStaToString(O_Palle_sta_2,"O_Palle_sta_2")
String = "<html><h1>Indlæs forrige program?</h1>
<p>Antal Hele lag: "+to_str(O_Hele_Lag)+" stk</p>
<p>Antal på nuværende lag: "+to_str(O_Antal_paa_Lag)+" stk.</p>
<p>Kasse Indhold: "+to_str(O_Poser_I_Ks)+" x "+to_str(O_Pose_Vaegt)+"</p>
<p>PallePlads 1:  "+Palleplads1+" Status: "+Plads1STA+"</p>
<p>PallePlads 2: "+Palleplads2+" Status: "+Plads2STA+"</p>
</html>"
#popup(String,title="Program",warning=False)
ProgramOK = request_boolean_from_primary_client(String)
if ProgramOK:
	#overfør data fra OLD til nuværende
else:
#opret nyt program
end
end

Hi @mawi,

Welcome to the UR community!

The request from primary client script functions have a limit of around 270 chars. In you case I think you can squeeze it in. With the following modification:

  • It is always interpreted as HTML, so you can remove the html tag
  • Instead of having a paragraph tag for each line, substitute it with a <br> for the line shift
  • remove the line shift chars in the script. This is heavily compromising the readability of you script, but seems necessary in your case
def Popup():
#Palleplads1 = "PalleINTtoString(O_Palle_1,"O_Palle_1")
#Palleplads2 = PalleINTtoString(O_Palle_2,"O_Palle_2")
#Plads1STA = PalleStaToString(O_Palle_sta_1,"O_Palle_sta_1")
#Plads2STA = PalleStaToString(O_Palle_sta_2,"O_Palle_sta_2")
Palleplads1 = "Europa Palle"#"PalleINTtoString(O_Palle_1,"O_Palle_1")
Palleplads2 = "Industri Palle"#PalleINTtoString(O_Palle_2,"O_Palle_2")
Plads1STA = "Fuld"#PalleStaToString(O_Palle_sta_1,"O_Palle_sta_1")
Plads2STA = "Igang"#PalleStaToString(O_Palle_sta_2,"O_Palle_sta_2")
O_Hele_Lag = 2
O_Antal_paa_Lag = 0
O_Poser_I_Ks = 8
O_Pose_Vaegt = 250

String = "<h1>Indlæs forrige program?</h1>Antal Hele lag: <b>"+to_str(O_Hele_Lag)+"</b> stk<br>Antal på nuværende lag: <b>"+to_str(O_Antal_paa_Lag)+"</b> stk.<br>Kasse Indhold: <b>"+to_str(O_Poser_I_Ks)+" x "+to_str(O_Pose_Vaegt)+"</b><br>PallePlads 1:  <b>"+Palleplads1+" </b>Status<b>: "+Plads1STA+"</b><br>PallePlads 2: <b>"+Palleplads2+" </b>Status<b>: "+Plads2STA+"</b><br>"
#popup(String,title="Program",warning=False)
ProgramOK = request_boolean_from_primary_client(String)
if ProgramOK:
	#overfør data fra OLD til nuværende
else:
#opret nyt program
end
end

An alternative is to make use of the popup functionality on the dashboard server. The pros is the limit of chars is not that low. But the cons is the lack of user input. You can do that like this:

socket_open("127.0.0.1", 29999, socket_name="dash")
line_feed="
"
String = "<h1>Indlæs forrige program?</h1>Antal Hele lag: <b>"+to_str(O_Hele_Lag)+"</b> stk<br>Antal på nuværende lag: <b>"+to_str(O_Antal_paa_Lag)+"</b> stk.<br>Kasse Indhold: <b>"+to_str(O_Poser_I_Ks)+" x "+to_str(O_Pose_Vaegt)+"</b><br>PallePlads 1:  <b>"+Palleplads1+" </b>Status<b>: "+Plads1STA+"</b><br>PallePlads 2: <b>"+Palleplads2+" </b>Status<b>: "+Plads2STA+"</b><br>"
socket_send_string("popup "+String+line_feed, "dash") 

Please keep in mind that it is now crucial that the “String” does not contain any line feed chars.

Best regards
Ebbe