Hi Bvg...
I was trying to shorten my code... Ill give you a more detailed rundown...
I am sending commands to a graphics playout server casparcg (add dot com for domain) I need to include quotes and escapes in the XML to the Caspar Graphics server that I am connecting to via socket connection...
The command I need to send to the socket is in the format below:
Code: Select all
CG 1-1 ADD 0 "demo/test" 1 "<templateData><componentData id=\"f0\">
<data id=\"text\" value=\"Niklas P Andersson\">
</data> </componentData><componentData id=\"f1\">
<data id=\"text\" value=\"developer\">
</data> </componentData></templateData>"
I cannot put the code in a livecode script as above as the quotes are taken literally and create errors in the script. So I put all the segments into a variable xml... then send the xml to the server (I note a typo in my original code... should be "write xml to socket localhost"... not "send xml to socket localhost" The actual IP address is specified by a field in my app...
My actual code refers to field variables for the video layer that are specified by the livecode app: eg field introvl is the intro video layer (or 1) and introfl is the flash layer 0
Code: Select all
put "CG 1-" after xml
put field introvl of card settings after xml
Put " ADD " after xml
put field introfl of card settings && field intro of the card settings after xml
put " 1 " after xml
put quote after xml
put "<templateData><componentData id=\" after xml
put quote after xml
put "f1\" after xml
put quote after xml
put "><data id=\" after xml
put quote after xml
put "text\" after xml
put quote after xml
put " value=\" after xml
put quote after xml
put field competition after xml
put "\" after xml
put quote after xml
put " /></componentData></templateData>" after xml
put quote after xml
write xml & format("\r\n") to socket field IP of card settings
I realize there may be a much better way of doing this (I am very open to a better way) But I am more a video graphics guy than a livecode programmer so I did what I had to to make it work...
So I need to know how to make the text in the field "competition" into the correct format when I bring it into the xml variable so when i send it to the server via the socket it has the correct text format to include the special characters I need (Č Ć Ž Š Đ.)