Using visualgetpixelcolour for a link to see if its grey or blue

can seem to use visualgetpixelcolour as it takes the colour from in between each letter and gives a colour code for white.

ive done an extensive amount of searching to figure out if i can use ocr to extract the colour from the text link itself. if anyone could link me to a document or post helping me with this that would be greatly appreciated

Kindest Regards

anyone help me out?!

You can make a macro that scans the color of the link e. g. 10 times. Each time you move by e. g. 2 pixel. This way you certainly hit the text color.

You will see that usually text (font) colors are in shades, not a fixed color. => In the macro I converted the color code to decimal. Now you can easily add a comparison e. g. if 100 < value < 150 then it is blue (I am not sure what the color codes for blue are, 100/150 are just an example)

{
  "Name": "gettextcolor",
  "CreationDate": "2023-2-11",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://forum.ui.vision/t/using-visualgetpixelcolour-for-a-link-to-see-if-its-grey-or-blue/11833",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "XMoveRelative",
      "Target": "getcolor_dpi_168.png",
      "Value": "",
      "Description": "Get color inside word"
    },
    {
      "Command": "XMove",
      "Target": "1,1",
      "Value": "",
      "Description": "Get the mouse cursor out of the way"
    },
    {
      "Command": "store",
      "Target": "${!imagex}",
      "Value": "x",
      "Description": ""
    },
    {
      "Command": "times",
      "Target": "10",
      "Value": "",
      "Description": "Scan the area and get 10 values"
    },
    {
      "Command": "visualGetPixelColor",
      "Target": "${x},${!imagey}",
      "Value": "c_hex",
      "Description": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "var h = ${c_hex}; h = h.replace (\"#\", \"0x\"); return Number (h);",
      "Value": "c_decimal",
      "Description": "Convert HEX color to decimal"
    },
    {
      "Command": "echo",
      "Target": "Color at ${x} is ${c_hex} (Dez:${c_decimal})",
      "Value": "green",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "FONT COLOR EXAMPLE",
      "Value": "${c_hex}",
      "Description": "Print the color "
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return Number (${x}) + 2",
      "Value": "x",
      "Description": "Add 2"
    },
    {
      "Command": "end",
      "Target": "",
      "Value": "",
      "Description": ""
    }
  ]
}

See also:

Thanks so much, now i have the problem of there being multiple shades of blue.

Im using as follows
If|varwithcolor=| then there are 4 colors, do i have to repeat the line multiple times or can i get it to accept mutiple color tags

The IF command uses Javascript syntax, so you can use Logical AND && and OR ||.

if | ${color} == "#123456" || ${color} == "#123999" || ${color} == "#120056"

1 Like

Is there a way to get visualgetpixel to simulate this same action but using a start location like 528,315? Without sandbox would be preferred i still have alot of learning to do on that side