Much of my first juvenile euphoria caused by MacroScheduler has been washed away by some unexplainable problems the most severe of which is the fact that FindImagePos seems to fail under the conditions specified here below.
First a word about the scenario:
a) There is our existing database application ("DBApp") where DB records are selected so that some of their content can be posted to a third party website.
b) There is an instance of IE11 created by MacroScheduler ("MSched" for short). It receives the url to load from DBApp currently via the clipboard (later SDK is planned) and subsequently it also receives some text to post inside the loaded browser.
Second, there are these buttons with graphics affected:
There are four buttons in IE delivered from the said website. MSched ALWAYS finds them perfectly through FindImagePos.
Within DBApp there are these four (currently very ugly) big action buttons and this is where the problems come up.

The main logic in MSched loops through the records previously selected in DBApp. For every record the script performs these actions:
- Press button 1 and then perform some IE actions
Press button 2 and then perform some IE actions
When they were fined properly, press button 3 in DBapp
End of one loop cycle. Start all over again.
I have spent yesterday about 12 hours on this problem, I checked the code multiple times and I cannot see any differences in the code or variables between the first and any subsequent loop cycle.
Code: Select all
// -------------------------------------------------------------------------------------
// Find DBApp Profile browser Button 1 and open new IE on profile
SRT>ESOFindProfileBrowserButton1
Let>resProfileSkip=NO
Gosub>PCRActivateWindowDBApp
//Find and Left Click Center of
FindImagePos>%SysVarDirBmp%\ESOPCRButton1.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
Wait>0.5
LClick
Wait>1
// get next URL from clipboard as inserted by DBApp
GetClipBoard>currURL,0
Gosub>IECreateNew,currURL
Gosub>PCRSentCheckProfileMissing
ELSE
Gosub>PCRMsgESONotFoundEndApp
Endif
END>ESOFindProfileBrowserButton1
// -------------------------------------------------------------------------------------
// Find DBApp browser Button 2 - get text to be sent in IE
SRT>ESOFindProfileBrowserButton2
Gosub>PCRActivateWindowDBApp
//Find and Left Click Center of DBApp button
FindImagePos>%SysVarDirBmp%\ESOPCRButton2.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
Wait>0.5
LClick
Gosub>IEWaitForIE
// keep PCR text in currText till needed
Wait>1
WaitClipBoard
GetClipBoard>currText,0
Wait>1
ELSE
Gosub>PCRMsgESONotFoundEndApp
Endif
END>ESOFindProfileBrowserButton2
Code: Select all
FindImagePos>%SysVarDirBmp%\ESOPCRButton1.bmp,WINDOW:SysESOTitleProfileBrowser,0.7,1,XArr,YArr,NumFound,CCOEFF
As for the moment I worked around this through a hack by storing absolute x/y coordinates during the first run but this still worries me because I am currently still in the testing phase and my intent is to base a whole new product on the use of MSched and to go through the SDK.
I should mention that the related DBApp window is not (what I would call) a native Windows window but it is a child window of the DBApp's main form (pardon, I am not a compiler user; after using pure o-o since 1986 I don't want to go back to the Flinstones, bother about mallocs, pointers and all this stuff).
What could be the reason of all of this? I could also send you the entire code and the bmp files if that helps.
Best regards
Heinz57