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: