The image matching would only work for large image changes since it looks at the entire image. What you need is something like the attached robofile. (Note, you MUST download RR again as this requires some updates we just made). The technique in the attached robofile first looks for the red wire end caps (RGB_Filter). It uses this detection to then create a area that is thinner (erode) than the wire caps and just above them (translate). This area is then used on the original image and the colors sampled (color sample) to tell you what the colors of ALL the attached wires are. You can then see this information printed at the end in the form of Hexadecimal color information (i.e. FFFFFF is white, 000000 is black, etc.)
I'd recommend really using an image that is closer to the final setup as it does not look like this is the final setup. When you change the setup this technique may or may not continue to work correctly. Using just a single sample image is hard to create a generic solution. Regardless, I think it does what you ask.
Note that you'd then obviously need to check that the variables are in the right order ... but before we get into that I'd recommending using the final image so we don't need to redo things more than needed.