Forum Discussion

scsvel's avatar
scsvel
Frequent Contributor
14 years ago

RGB method error


Hi all,

 I am using TC version - 7.50.653.3 and executing simple script mentioned below.. I got 'Object expected' error in line 4,5.



1. function Test(){

2.   var Attr;

3.   Attr = Log.CreateNewAttributes();

4.   Attr.FontColor = RGB(192, 0, 0);

5.   Attr.BackColor = RGB(255, 255, 0);  

6.   Log.Message("My message", "", pmNormal, Attr);

7. }



Anything here wrong and I am using Javascript.

Anybody help me on this?

Thanks...

2 Replies

  • Hi,

    you are missing all the methods defined in the example. The complete example is:



    function Test()

    {

     var Attr;

     Attr = Log.CreateNewAttributes();

     Attr.FontColor = RGB(192, 0, 0);

     Attr.BackColor = RGB(255, 255, 0);  

     Log.Message("My message", "", pmNormal, Attr);

    }


    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);

    }





    --> Its in the TC help file

  • scsvel's avatar
    scsvel
    Frequent Contributor
    Hi Valentine,



    Very thank you for your reply.. I thought this is built-in method in TestComplete... Thank you again...