For a balding guy at 58 having code that looks perfect, but doesn't work, is decidedly bad for the hair styling.
Bad hair days? How about, bad none hair days!
To set this up:
I have an ATE toolbar that doesn't expose itself to PTD in any meaningful way. Total of 17 Toolbar Buttons.
(The original programmer named every button exactly the same!)
[Why, when creating the Control Array, when he added the correct ICON to the button, didn't he also Name It!]
One ATE version has all of the possible Toolbar Icons, the others lose different ones in differing locations.
This means that the Bitmap Capture, Crop and Find methods have to be used to adjust for differing ATE variants,
So, I collect my reference Toolbar Icons, store them in my directory and load them into an array.
I then use a routine to match the "Name" of the Toolbar Button to the Icons Position in the array and then do a find.
Then, depending if I've set a global debugmode variable either MouseClick or MouseMove and return.
So, after debugging all the missing semi-colons and incorrect cases in my spelling and run the thing...
It correctly MouseMoves to: 0, 4, 7, 9, 12, 16 (No discernable pattern there).
So, I play with my code some more... No luck...
Well, maybe PTD is doing something to the Graphics in the Array?
So, I add a routine to immediately dump the Array out under different names after loading....
It's Pristine... Sheeeeesh! What's going on????
So, I create a test routine using the catured Window bitmaps and the code works perfectly.
The mouse moves every second to the next ICON.
Hmmmmmmm.... Lose a little more hair.....
On a lark, I decided to add a MouseMove off the window, Window.MouseMove(-15,-15) just after the one second delay.
Viola! Eureka! *IT WORKS*!!!!
I then moved the "clear the window" MouseMove to just before the window capture and it still works.
I remove the "clear the window" MouseMove and I get the sequence above again. Strange.
The sequence exists and the mouse stops moving, except for the sequence, even when the target Button ICON doesn't have a Mouse Cursor on it...
It seems that, for whatever reason, PTD can't handle running a find() (reliably) when a Mouse Cursor is captured on the Window being searched.
Even when the Mouse Cursor is not in the find() target area of interest...