Are there any tips to improve the speed of capturing object pictures for comparing pixels?
My application uses codeJock tabs that I have to recognise with text recognition. The only way to identify the current tab is to test the background colour of each textObj (tab). I am only testing the first pixel of the text object but it takes 20 seconds.
There are two parts to this.
1) Take a picture of the text object. Takes about 20 seconds per picture captured.
2) Test the top left pixel of the text object picture to see if it it blue. Takes less than a second.
My VBS code to find the currentTab looks something like:
for each textObj in parentObj.findallchildren("Name", "textObject*")
if textObj.picture.pixels(0,0) = currentTabBGColour then
currentTab = textObj.text
exit for
end if
next
Each time I take a textObj picture wastes 20 seconds so I have adapted my code to take one big picture of the parent object and inspect the pixels at the top left corner of each textObj
set textCollectionPicture = parentObj.picture
for each textObj in parentObj.findallchildren("Name", "textObject*")
if textCollectionPicture.pixels(textObj.left, textObj.top) = currentTabBGColour then
currentTab = textObj.text
exit for
end if
next
This take less than half the time to execute because only one picture is taken but it is still slow.
Is there a faster way to get the picture object of a control so that I can do my pixel inspection?
Thanks.