View Full Version : SetText()
mhkolar
02-23-2004, 02:22 PM
Hi All,
I'm trying to make an external script call from a C++ program to change the text in a scrolling CG line. I've successfully built the Remote Script example and communicated with VT[3]. I'm trying to use the "SetText(name,text)" call declared in the VTScript documentation, but not seeing any results. I have a couple of questions:
Which window should I be connecting to, the CG window or the CG Player window? (I figure it's the player?) I've successfully connected to both, which is encouraging.
What name is the "name" parameter referring to? The saved .cg filename? The Downstream Key Identifier ("CG")? (I've tried both)
I assume the "text" parameter should be the plain text, in quotes?
If I make the call correctly, when will the text output change? Instantaneously? When it loops? After it's stopped and restarted? My intent is to dynamically modify a live crawl based on the contents of a text file. Will this external script call get it done, or is there a better way?
Thanks in advance,
Mike
mhkolar
02-26-2004, 09:26 AM
Hi All,
Well, after much wandering about blindly, I've answered my own questions. For anyone who's interested:
Originally posted by mhkolar
Which window should I be connecting to, the CG window or the CG Player window? (I figure it's the player?) I've successfully connected to both, which is encouraging.
You can connect to either window. The CG MUST be stopped- you can make sure it is stopped by sending the Que() command- that's apparently Canadian for "Cue" :) I actually had to send it twice to make it work reliably.
What name is the "name" parameter referring to? The saved .cg filename? The Downstream Key Identifier ("CG")? (I've tried both)
If you double-click on the text line in the layout tab, you can set the name of a line of text. By default it looks like this:
- TEXT [Your text Here.]
"TEXT" is actually a name that you can change, then reference in TScript. I stumbled upon this completely by accident, been meaning to go through the CG docs to see if it's documented.
I assume the "text" parameter should be the plain text, in quotes?
Yes. The name parameter should also be in quotes.
If I make the call correctly, when will the text output change? Instantaneously? When it loops? After it's stopped and restarted?
As I mentioned before, the crawl must be cue'd, not in motion, and it will change immediately. Unfortunately that means resetting the motion as best I can tell.
My intent is to dynamically modify a live crawl based on the contents of a text file. Will this external script call get it done, or is there a better way?
There's actually a little more to it than that once I got down to it: my intended format is a right-to-left dynamic text crawl on the bottom, with a stationary dynamic text banner right above it. I've had to not use automatic motion, and set the position of the crawl manually.
So the meat of my loop looks like this:
promoText=foundNewPromoText();
if (promoText){
sprintf( promoCmd, "SetText(\"Promo\",\"%s\"",promoText);
CG.SendCommand( promoCmd );
}
crawlText = foundNewCrawlText();
if (crawlText){
sprintf( crawlCmd, "SetText(\"Crawl\",\"%s\"",crawlText);
CG.SendCommand( crawlCmd );
}
xoffset = computeXOffset( time );
sprintf( crawlCmd, "SetOffset(\"Crawl\",%d,%d)", xoffset, yoffset );
In our next exciting episode:
Can I get the text width in pixels from the GetWidth() call? Don't know yet if SendCommand can/will provide me a return value from a TScript command. Otherwise I'll have to code in matching font info and use GetTextExtent() to get the text width so I can manage my crawl.
Fun and games,
Mike
mhkolar
03-03-2004, 09:12 PM
More in our continuing saga...
Since I can set the font size through TScript, I was able to use the GetTextExtent() windows call to decide how long the crawl was, and position and restart it correctly. Everything was beautiful until I tested it with a real crawl- which is around 500 characters long. If I make a SetText() call with a 500 char string, it takes the Toaster about 20 seconds to process it (!). During which time VT[3] is unresponsive. This is unacceptable of course. Can't decide where the bottleneck is- if I paste the same line of text manually, it's instantaneous. Is this a limitation of windows messaging, or some problem with how VT processes them?
Mike
PIZAZZ
03-03-2004, 10:39 PM
Mike,
Keep after it. We hope to see some updated ToasterScript docs soon to help all of us 3rd party guys.
Have you contacted Andrew or Kevin about your issues?
Keep the faith my brother.
mhkolar
03-04-2004, 08:37 AM
Originally posted by PIZAZZ
Keep the faith my brother.
Hey, signs of life! Thanks for the reply!
Just in time for the final episode- last night after my last post I scrapped the TScript approach completely and wrote a DSK app based on the "output with alpha" example in the SDK. Works like a charm- I get complete control over the text and movement, and I was able to alpha it right over the output. My faith was a little shaky after the TScript experience, but actually coding up a DSK was surprisingly easy. Still a little optimizing to do (I could handle my offscreen bitmaps better to fit my new scheme). One last experiment with TScript to launch my prog from a menu and I'll be happy.
Regards,
Mike
PIZAZZ
03-04-2004, 10:41 AM
Mike,
Let me know if I can help you in any way.
We do quite a bit of scripting around here.
Jef
djlithium
03-29-2004, 06:16 PM
I don't suppose you have had any success in having the name of a clip in a DDR being used as an overlay for the CG to PGM out and the DSK?
This would be super cool and handy if you can get it to work with some control over location.
PIZAZZ
03-29-2004, 06:51 PM
I believe I know where you are going with this,
The project we talked about could benefit from seeing the clip playing name on the output I guess. hmmmmm.
I will look a little further into it myself.
Cool possibilities, very cool possibilities.
djlithium
03-29-2004, 07:10 PM
now if someone could implant some coding knowledge into my head I could help out.
I am just a creative solutions type guy.
:P
vBulletin® v3.8.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.