vMix Forums
»
General
»
GT
»
Proper line breaks in GT Title page text box when being fed via API call and/or a vb.net script
Rank: Newbie
Groups: Registered
Joined: 6/21/2025(UTC) Posts: 2 
|
Hello, I've been trying to solve a mystery with a GT Title graphic. We use a custom written interface to send text box data to vMix GT Title pages and that works fine. This recent goal is to get a paragraph into a text box complete with proper line breaks. The path to the title page looks like this:
User enters text data into a script in Rundown Creator When needed, an API call is made to Rundown Creator to retrieve the data, and is then funneled into the 'Dynamic2' variable VB.NET script in vMix takes the data, strips the \n's from the lines, and hopefully inserts the proper line breaks VB.NET script then performs an internal API call to deposit the sanitized variable to the title page.
All of this works, except all of the text is being mashed into a single line, with no line breaks.
The title page has an actual text box, with enough room to handle the data. It's set to shrink as needed to ensure everything fits.
Here's the VB.NET script I'm using:
***** dim xmldoc as new system.xml.xmldocument xmldoc.loadxml(API.XML())
' Read Dynamic2 value from XML dim rawText as String = xmldoc.selectsinglenode("/vmix/dynamic/value2").InnerText
' ----------------------------- ' CONFIGURATION ' -----------------------------
Dim inputName As String = "FULLSCREEN" ' Title input name Dim textField As String = "TEXTBOX" ' Title text field name
' ----------------------------- ' PROCESS TEXT ' -----------------------------
' Convert \n into real line breaks
Dim lf As String = System.Text.Encoding.ASCII.GetString(New Byte() {10}) Dim cr As String = System.Text.Encoding.ASCII.GetString(New Byte() {13})
Dim t As String = rawText t = t.Replace(cr & lf, lf) ' CRLF -> LF t = t.Replace(cr, lf) ' CR -> LF t = t.Replace("\n", lf) ' literal \n -> LF
'Console dump so I can see what's happening
Console.WriteLine(t)
' ----------------------------- ' SEND TO VMIX TITLE ' -----------------------------
API.Function("SetText", Input:=inputName, SelectedName:=textField + ".Text", Value:=t)
*****
If I try this as an example text: Hello\nWorld!
vMix does strip the \n out, but leaves me with 'HelloWorld!'; no line breaks.
Since I know little to nothing about VB.NET scripting, I did use ChatGPT to help write this. So it's possible it missed something. I've had decent luck getting a working script out of it but they've required a lot of finessing.
Any help you can provide would be greatly appreciated!
|
|
|
|
|
|
vMix Forums
»
General
»
GT
»
Proper line breaks in GT Title page text box when being fed via API call and/or a vb.net script
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The vMix Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close