Page 1 of 1

How can I automate Color Dialogue

Posted: Fri Jul 20, 2007 1:39 pm
by saurabh
I want to automate Color dialogue but i didn't get any API in Ranorex .NET Library.
Even Ranorex Spy is not identifying the color box in color dialogue there is no control Name or control id for each color box.
Its just giving some common parent so i am unble to select a particular color from there.Apart from this the there is no control name giving by Ranorex spy for button containing by color dialogue.
Please help me out to do that.Its very critical for my client.I am using paid version of ranorex.

Here no Control Name show by Ranorexspy for these buttons
1.OK
2.Cancel
3.Add To Custom Color

also for
Basic colors
custom colors

Send me code for the same

Posted: Fri Jul 20, 2007 3:21 pm
by webops
The following code sample reads the selected colors (red, green and blue) from the dialog, sets red=64, green=128 and blue=192 and clicks the OK button.

Code: Select all

Form form = Application.FindFormTitle("Color");
if (form == null)
    return 1;

Element red     = form.Element.FindChild(Role.Text, "Red:");
Element green   = form.Element.FindChild(Role.Text, "Green:");
Element blue    = form.Element.FindChild(Role.Text, "Blue:");

if( red == null || green == null || blue == null )
{
    Console.WriteLine("ERROR: red, green or blue edit box not found");
    return 1;
}

Console.WriteLine("Color Red={0} Green={1} Blue={2}", red.Value, green.Value, blue.Value);
red.Value   = "64";
green.Value = "128";
blue.Value  = "192";

Element okButton = form.Element.FindChild(Role.PushButton, "OK");
if (okButton != null)
    Mouse.ClickElement(okButton);

return 0;
Gabor
Ranorex Team