Adding color text in a If() JSLHi,
I am writing a JSL Script and not sure how to add color text in this If() code. I want to add green color indicate for "Ideal" and red color for "Not Ideal".
If(P <= 0.5 & C > 0.8, "Ideal",
P > 0.5 & C < 0.8, "Not Ideal",
);
Thanks!
Automation and ScriptingRe: Adding color text in a If() JSLWhere is the "Ideal" or ""Not Ideal" going to be displayed? In a data table, a report, a dialog box?
Re: Adding color text in a If() JSLYou will need to use Markup notation to change the text color.
See the Scripting Index
Text Box=>Markup
Here is an example from the Scripting Index entry
Names Default To Here( 1 );
win = New Window( "Example", fontobj = text = Text Box( "Example Text" ) );
text << setText(
"This is <FONT color="Blue">blue</FONT> text. This is a <BACKGROUND color="yellow">yellow</BACKGROUND> background. This is <FONT color="#0000ff"><BACKGROUND color="0xffff00">blue text on a yellow background</BACKGROUND></FONT>."
);
text << markup;
Re: Adding color text in a If() JSLIf you want the entire string to be one color you can use << text color("color").
nw = new window("Test Colors",
r = text box("Red Color", << text color("red")),
b = text box("Blue Color", << text color("blue"))
);

The scripting index is your friend here.
Re: Adding color text in a If() JSLHi Jim,
Thanks for replying back!
Here is a simplified version of my code. The "Ideal" or ""Not Ideal" is going to be displayed in a dialog box.
P = 0.4
M = If(
P <= 0.5 & C > 0.8, "Ideal",
P > 0.5 & C < 0.8, "Not Ideal",
);
M_Output << set text( Char( M ) );
),
Outline Box( "Results",
Panel Box( "Message",
Lineup Box( N Col( 2 ),
Text Box( "Output: " ),
M_Output = Text Box(),
)
),
Maria