Hi Darren.
Use a script below.
"{M:WHITE}" attaches the material to the text object (in my opinion works only v.10 and higher, in м.7 it definitely doesn't work)
Dim txtObj As xpTextObject
Dim numValue As Double
self.GetObjectByName("DOW JONES CHANGE", txtObj)
If Double.TryParse(txtObj.Text, numValue) Then 'the script does not stop if the text is not a number
If numValue > 0 Then
txtObj.Text = "{M:STOCKS GREEN}" & txtObj.Text
ElseIf numValue < 0 Then
txtObj.Text = "{M:STOCKS RED}" & txtObj.Text
Else
txtObj.Text = "{M:WHITE}" & txtObj.Text
End If
End If
And if the script doesn't work, try using the script below. You will need to create three fonts with three colors: white, red and green. The script applies the corresponding font to the text object
Dim txtObj As xpTextObject
Dim numValue As Double
self.GetObjectByName("DOW JONES CHANGE", txtObj)
Dim temptxt as String = txtObj.Text
txtObj.Text = ""
If Double.TryParse(temptxt, numValue) Then
Dim font As xpFont
If numValue > 0 Then
self.Project.GetFontByName("STOCKS GREEN", font)
ElseIf numValue < 0 Then
self.Project.GetFontByName("STOCKS RED", font)
Else
self.Project.GetFontByName("WHITE", font)
End If
txtObj.CurrentFont = font
End If
txtObj.AppendToLine(0, temptxt)
------------------------------
Roman Yaroshenko
chief specialist
RBC-TV
Moscow Russian Federation
------------------------------