Forum Discussion
// Edit log messages
function CorrectRGBComponent(component)
{
component = aqConvert.VarToInt(component);
if (component < 0)
component = 0;
else
if (component > 255)
component = 255;
return component;
}
function RGB(r, g, b)
{
r = CorrectRGBComponent(r);
g = CorrectRGBComponent(g);
b = CorrectRGBComponent(b);
return r | (g << 8) | (b << 16);
}
function Pass(Msg)
{
var Attr;
Attr = Log.CreateNewAttributes();
Attr.FontColor = RGB(22, 20, 23);
Attr.BackColor = RGB(170, 227, 162);
// Passes the LogAttributes object to the Message function
Log.Message("PASS - " + Msg, "", pmNormal, Attr);
}
// Update the log file with the FAIL info and clore it red
function Fail(Msg)
{
var Attr;
Attr = Log.CreateNewAttributes();
Attr.FontColor = RGB(251, 251, 251);
Attr.BackColor = RGB(221, 33, 60);
// Passes the LogAttributes object to the Message function
Log.Error("FAIL - " + Msg, "", pmNormal, Attr);
}
function Information(Msg)
{
var Attr;
Attr = Log.CreateNewAttributes();
Attr.FontColor = RGB(22, 20, 23);
Attr.BackColor = RGB(197, 197, 198);
// Passes the LogAttributes object to the Message function
Log.Message("INFORMATION - " + Msg, "", pmNormal, Attr);
}
Looks awesome. Can you give an example on how to use this? I tried running the code but get multiple compilation errors.