This automatically calls the JavaScript-Function update(templatedata) if that is defined in your html page or in a JS-file that is referenced via the html page.
Our problem is, that we can enter the method, however we do not know how to process “templatedata” or how to manipulate the dom-tree, which was our goal in the first place.
Currently we always get a pipe error.
[2018-10-08 16:48:24.75[1008/164824:ERROR:ipc_channel_win.cc(405)] pipe error: 2322] [12820] [info] Received message from 127.0.0.1: CG 1-1 ADD 0 basis 0 {‘test’}\r\n
So it seems our main problem is, how to escape the parameters to avoid the pipe error.
here i have added an HTML template “topBar/TOPBAR” (folder/File)
then the XML:
indent preformatted text by 4 spaces <templateData> <componentData id=\"TopText\"><data id=\"text\" value=\"Hello\"/></componentData> </templateData>
this XML alters the DOM
On my template sets a DIV with then ID of TopText to <data id=“text” value=“Hello”/>
this helps a lot. Since I do not have the testsystem with me, I have a further question:
You escaped the quotes for the command - fine
now the xml is arriving in the update(templatedata) function
Will caspar CG automatically check whether there are existing IDs in the DOM-tree to update? I would expect one has to parse the xml, find according nodes in the dom-tree in the method and update these manually?
as far as testing, if you don’t have a windows computer to try them out in CasparCG you can do it in chrome. load your html hit f12 start the console and you can inter the command by hand
example: play();
i like adobe Brackets for a text editor it is free and it has a menu option to preview in a browser.
all so if you go the edge animate route there is a console that will let you send commands.
Now if I place a button inside my HTML.page (which loads and displays perfectly) and assign the sayHello() method to that button, everything is fine when I click the button:
sayHello() is called and then calls update and displays my text that is passed as parameter.
HOWEVER when I try this from Caspar CG via command line, the templatedata parameter arriving in the JavaScript is always undefined. THAT EXACTLY is my problem.
The CCG-notion I am using for this on the command line is:
It seems closely connected to the server version. So far we have used the 2.0.7 - when I am using the 2.1.0 beta, I can place a button on the screen, click the button and call update(templatedata) - the button does not work in 2.0.7.
So I am struggeling the “CG UPDATE”:
I do not want to display my html template newly (like “ADD”)
the onScreen-Button triggers update correctly. In fact it calls update via a function that is bound to the button:
function sayHello()
{
update(“my update data”);
}
However I do not manage to get text to the update function via “CG UPDATE”
In the documentation I can find hints towards xml (" Data is either inline XML or a reference to a saved dataset."), however a real example is missing.
I am sure it will be damn easy once it works, for now I am stuck though…
When following functions are defined in html template-
function font(str)
{
document.getElementById(“marqueedata”).style.fontFamily = str;
}
function fontcolor(str)
{
document.getElementById(“marqueedata”).style.color = str;
}
I normally use function call to update the properties like this-
j[quote=“hboo, post:8, topic:903”]
In the documentation I can find hints towards xml (" Data is either inline XML or a reference to a saved dataset."), however a real example is missing.
[/quote]
It‘s exactly the same way for UPDATE than for ADD. So the XML is formated the same. So refer to ADD for the example. Also ADD and UPDATE call the same method to update the data. Only UPDATE does not trigger the intro animation.
Thank you so much - caspar tells me what is wrong, I however do not know what to change.
My Command-Line expression is:
CG 1-5 UPDATE 1 casparcg 0 “this is my other text”
The answer from the server is:
[2018-10-16 08:52:21.756] [3192] [info] ffmpeg[clf2.mov|720x576i50.00|368/369] Destroyed.
[2018-10-16 08:52:42.441] [10796] [info] Received message from 127.0.0.1: CG 1-5 UPDATE 1 casparcg 0 this is my other text\r\n
[2018-10-16 08:52:42.478] [9760] [info] No CG proxy running on layer. Check syntax. Turn on log level debug for stacktrace.
[2018-10-16 08:52:42.478] [9760] [info] Sent message to 127.0.0.1:403 CG UPDATE FAILED\r\n
are you willing to share your template?
you can send me a personal message with a dropbox link if you would like, and i can try to look at it in the next day or two. as long as the work stays calm.
ok i did have some luck
this is what i did.
i have sent the commands form the command line
same as you did and got nothing.
CG 1-20 UPDATE 1 “Hello World”\r\n
how ever i sent the command form the Client and looked at the message revived. that did work, the text changed.
so i noticed that there comand sent was in <>
so i sent this command CG 1-20 UPDATE 1 "<Hello World>"\r\n
and bam it worked.